/* Interactive demo: a macOS desktop with two windows, and Screen Translator's
   overlay replayed on top of it. The overlay rules below are copied from the
   app's Overlay.vue (colours, radii, HUD), so the demo looks like the real
   thing. Everything lives on a fixed 1280×800 "screen" scaled to fit. */

.st-demo { margin-top: clamp(40px, 6vw, 64px); }

.st-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(27, 24, 22, 0.45), 0 0 0 1px rgba(27, 24, 22, 0.12);
  background: #1b1816;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.st-screen {
  position: absolute;
  left: 0; top: 0;
  width: 1280px; height: 800px;
  transform-origin: 0 0;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Apple SD Gothic Neo", "PingFang SC", sans-serif;
  color: #1d1d1f;
  /* Wallpaper */
  background:
    radial-gradient(900px 600px at 12% 8%, #ffb48a 0%, transparent 60%),
    radial-gradient(800px 700px at 92% 18%, #8fb5ff 0%, transparent 62%),
    radial-gradient(900px 700px at 60% 110%, #ff7a59 0%, transparent 60%),
    linear-gradient(160deg, #f6d1b9 0%, #c9b5e8 55%, #9fb8f0 100%);
  cursor: crosshair;
}
.st-screen.window-hover { cursor: none; }

/* ---------- Menu bar ---------- */
.st-menubar {
  position: absolute; left: 0; right: 0; top: 0; height: 30px;
  display: flex; align-items: center; gap: 22px; padding: 0 18px;
  font-size: 13.5px; color: #1d1d1f;
  background: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  z-index: 1;
}
.st-menubar b { font-weight: 700; }
.st-menubar .spacer { flex: 1; }
.st-menubar .tray {
  width: 24px; height: 20px; border-radius: 5px; display: grid; place-items: center;
}
.st-menubar .tray svg { width: 16px; height: 16px; stroke: #1d1d1f; fill: none; }
.st-menubar .tray.on { background: rgba(0, 0, 0, 0.12); }

/* ---------- Windows (rounded like the overlay's selection) ---------- */
.st-win {
  position: absolute;
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28), 0 0 0 0.5px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.st-toolbar {
  height: 52px; flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.st-lights { display: flex; gap: 8px; }
.st-lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.st-lights i:nth-child(1) { background: #ff5f57; }
.st-lights i:nth-child(2) { background: #febc2e; }
.st-lights i:nth-child(3) { background: #28c840; }
.st-url {
  flex: 1; margin-inline: 40px; height: 32px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.05); display: grid; place-items: center;
  font-size: 13px; color: #6e6e73;
}
.st-title { flex: 1; text-align: center; font-size: 13.5px; font-weight: 600; color: #3a3a3c; margin-right: 52px; }

/* Korean news window */
.st-news { left: 64px; top: 70px; width: 640px; height: 590px; z-index: 2; }
.st-news .body { padding: 34px 44px 0; width: 520px; }
.st-news .kicker { font-size: 13px; font-weight: 700; color: #d93025; letter-spacing: 0.02em; }
.st-news h3 { font-size: 30px; line-height: 40px; font-weight: 800; margin-top: 10px; color: #111; letter-spacing: -0.01em; }
.st-news .meta { font-size: 13px; color: #86868b; margin-top: 12px; }
.st-news .photo {
  height: 120px; margin-top: 22px; border-radius: 14px;
  background:
    radial-gradient(120px 60px at 70% 30%, #ffe08a, transparent 70%),
    linear-gradient(180deg, #23305e 0%, #3e4f8f 55%, #1d2a4a 56%, #24345c 100%);
  position: relative; overflow: hidden;
}
.st-news .photo::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 46%;
  background: repeating-linear-gradient(90deg, rgba(255, 220, 140, 0.25) 0 2px, transparent 2px 22px);
}
.st-news p { font-size: 16px; line-height: 27px; color: #2c2c2e; margin-top: 18px; }
.st-news .cta {
  display: inline-block; margin-top: 20px; padding: 9px 18px; border-radius: 999px;
  background: #1d1d1f; color: #fff; font-size: 14px; font-weight: 600;
}

/* Chinese menu window */
.st-menu { left: 612px; top: 214px; width: 560px; height: 486px; z-index: 3; background: #fbf6ee; }
.st-menu .st-toolbar { border-bottom-color: rgba(120, 80, 40, 0.12); }
.st-menu .body { padding: 26px 70px 0 120px; }
.st-menu h3 { font-size: 34px; line-height: 44px; font-weight: 800; color: #9b2c1f; }
.st-menu .sub { font-size: 14px; color: #8a6d52; margin-top: 4px; }
.st-menu ul { list-style: none; margin-top: 22px; display: grid; gap: 4px; }
.st-menu li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-block: 10px; border-bottom: 1px dashed rgba(120, 80, 40, 0.25);
  font-size: 20px; line-height: 28px; color: #3b2a1e;
}
.st-menu li .price { font-size: 17px; color: #9b2c1f; font-weight: 600; }
.st-menu .note {
  margin-top: 22px; padding: 12px 16px; border-radius: 12px; background: #f3e6d3;
  font-size: 15px; line-height: 24px; color: #6b4a2f; display: inline-block;
}

/* ---------- Prompt (before anything is clicked) ---------- */
.st-prompt {
  position: absolute; left: 50%; bottom: 7%; transform: translateX(-50%);
  padding: 13px 26px; border-radius: 12px;
  background: rgba(15, 15, 18, 0.86); color: #fff;
  font-size: 18px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  pointer-events: none; z-index: 20;
  transition: opacity 0.2s ease;
}

/* =========== Overlay — mirrors Overlay.vue =========== */
.st-overlay { position: absolute; inset: 0; z-index: 10; pointer-events: none; --window-radius: 20px; }
.st-overlay > * { position: absolute; }

.window-highlight {
  border-radius: var(--window-radius);
  background: rgba(64, 140, 255, 0.3);
  pointer-events: none;
}

.camera-pointer {
  width: 28px; height: 28px; transform: translate(-50%, -50%);
  pointer-events: none; color: #000;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.35));
}
.camera-pointer svg { display: block; width: 100%; height: 100%; fill: #fff; stroke: currentColor; stroke-width: 1.5; }

.dim {
  border-radius: var(--window-radius);
  box-shadow: 0 0 0 100000px rgba(0, 0, 0, 0.28);
}
.dim.outlined { outline: 1.5px solid rgba(255, 255, 255, 0.9); }
.dim.armed { outline-color: rgba(41, 151, 255, 0.95); }

/* Inner glow: pulses for as long as the selection is armed. */
.dim::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit;
  box-shadow: inset 0 0 28px 6px rgba(41, 151, 255, 0.55), inset 0 0 6px 1px rgba(120, 190, 255, 0.7);
  opacity: 0; pointer-events: none;
}
.dim.armed::after { animation: glow-pulse 1.4s ease-in-out infinite; }
@keyframes glow-pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dim.armed::after { animation: none; opacity: 0.8; } }

.size-badge {
  right: 0; bottom: -26px; padding: 2px 8px; border-radius: 5px;
  background: rgba(20, 20, 20, 0.85); color: #fff; font-size: 12px; white-space: nowrap;
}

.skeleton {
  border-radius: var(--window-radius);
  pointer-events: none;
  background: rgba(120, 190, 255, 0.14);
  box-shadow: inset 0 0 28px 6px rgba(41, 151, 255, 0.4);
  animation: glow-pulse 1.4s ease-in-out infinite;
  outline: 1.5px solid rgba(41, 151, 255, 0.95);
}
.skeleton.block-skeleton {
  border-radius: 6px; outline: none;
  background: rgba(120, 190, 255, 0.22);
  box-shadow: inset 0 0 8px 2px rgba(41, 151, 255, 0.45);
}
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }

.highlight {
  border-radius: 6px;
  background: rgba(41, 151, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(41, 151, 255, 0.5);
  pointer-events: none;
}

/* A translation patch, sat on the (blurred) background it covers. On a flat
   window the clean plate is just that colour, so the patch is too, with the
   same 6px feathered bleed. */
.patch {
  box-sizing: border-box;
  overflow-wrap: break-word;
  white-space: pre-wrap;
  pointer-events: none;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0;
}
.patch.plated { box-shadow: 0 0 6px 4px var(--plate); background: var(--plate); }
/* On a card or pill the patch takes the card's place, so no feathered bleed. */
.patch.carded { background: var(--plate); }
.patch.plain {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  font-weight: 400 !important;
  background: #fff; color: #000 !important;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(128, 128, 128, 0.6);
}

/* ---------- HUD ---------- */
.hud {
  --hud-bg: rgba(255, 255, 255, 0.97);
  --hud-border: rgba(0, 0, 0, 0.08);
  --hud-fg: #1d1d1f;
  --hud-btn: rgba(0, 0, 0, 0.05);
  --hud-btn-hover: rgba(0, 0, 0, 0.1);
  --hud-active-bg: #1d1d1f;
  --hud-active-fg: #ffffff;
  display: flex; align-items: center; gap: 6px; padding: 6px;
  border-radius: 999px;
  background: var(--hud-bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  border: 1px solid var(--hud-border);
  pointer-events: auto;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  animation: st-fade 0.12s ease;
}
@media (prefers-color-scheme: dark) {
  .hud {
    --hud-bg: rgba(28, 28, 32, 0.96);
    --hud-border: rgba(255, 255, 255, 0.08);
    --hud-fg: #f2f2f5;
    --hud-btn: rgba(255, 255, 255, 0.08);
    --hud-btn-hover: rgba(255, 255, 255, 0.18);
    --hud-active-bg: #ffffff;
    --hud-active-fg: #111114;
  }
}
@keyframes st-fade { from { opacity: 0; } }

.drag-handle { width: 18px; height: 34px; margin-right: -2px; display: grid; place-items: center; color: var(--hud-fg); opacity: 0.45; }
.drag-handle svg { width: 16px; height: 16px; stroke: currentColor; fill: none; }

.icon-btn {
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: var(--hud-btn); color: var(--hud-fg);
  cursor: pointer; display: grid; place-items: center; padding: 0;
}
.icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; }
.icon-btn:hover:not(:disabled) { background: var(--hud-btn-hover); }
.icon-btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn.active { background: var(--hud-active-bg); color: var(--hud-active-fg); }
.icon-btn.primary { background: #2997ff; color: #fff; }
.icon-btn.primary:hover:not(:disabled) { background: #47a6ff; }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: st-spin 0.7s linear infinite;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

.hud select {
  font: inherit; font-size: 12px; color: var(--hud-fg);
  background: var(--hud-btn); border: 1px solid var(--hud-border);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; max-width: 140px;
}
.hud .arrow { color: var(--hud-fg); opacity: 0.5; font-size: 12px; }

/* ---------- Caption under the stage ---------- */
.st-caption {
  margin-top: 16px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12.5px; color: var(--slate);
}
.st-caption button {
  font: inherit; color: var(--ink); background: none; border: none; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--signal); text-underline-offset: 3px; padding: 0;
}
