/* =======================================================================
   Hand Hub — Flow-style dark simulation overlay
   Recreates Google Flow / Veo3 UI as a high-fidelity backdrop for the
   AI cursor automation. Dark ground · pixel flower · prompt bar · settings popup.
   ======================================================================= */

.flow-shell {
  position: absolute; inset: 0;
  background: #0F0F10;
  color: #E8E8E8;
  font-family: 'Google Sans', 'Geist', system-ui, sans-serif;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* top toolbar */
.flow-top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: #0F0F10;
}
.flow-top .icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  color: #E8E8E8; opacity: 0.8;
  background: transparent;
}
.flow-top .icon-btn:hover { background: rgba(255,255,255,0.06); }
.flow-top .icon-btn svg { width: 18px; height: 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.6; }
.flow-top .stamp {
  font-size: 13.5px; color: #E8E8E8; font-weight: 400; letter-spacing: -0.1px;
  margin-right: 4px;
}
.flow-top .search {
  flex: 1; max-width: 380px; height: 40px;
  background: #1F1F1F; border-radius: 999px;
  padding: 0 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: #777;
}
.flow-top .search svg { width: 16px; height: 16px; opacity: 0.7; }
.flow-top .right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.flow-top .ultra-badge {
  font-family: 'Google Sans Display', system-ui, sans-serif;
  font-weight: 600; font-size: 11px; letter-spacing: 0.6px;
  background: #1F1F1F; color: #E8E8E8;
  padding: 6px 12px; border-radius: 999px;
}
.flow-top .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: #B6D2EA; color: #1A1F2E;
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}

/* left rail */
.flow-rail {
  position: absolute; top: 64px; left: 16px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2;
}
.flow-rail .rail-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: grid; place-items: center;
  color: #E8E8E8; opacity: 0.65;
  background: transparent;
}
.flow-rail .rail-btn.active { background: #1F1F1F; opacity: 1; }
.flow-rail .rail-btn svg { width: 18px; height: 18px; }

/* center stage: pixel flower + tagline */
.flow-stage {
  flex: 1; display: grid; place-items: center;
  position: relative;
  padding: 0 16px;
}
.flow-empty { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.flow-pixel-flower {
  width: 64px; height: 64px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 1px;
}
.flow-pixel-flower span { background: #fff; border-radius: 1px; opacity: 0.9; }
.flow-pixel-flower span.off { background: transparent; }
.flow-empty .tagline { font-size: 18px; color: #C0C0C0; letter-spacing: -0.2px; }

/* loading thumbnail card top-left of stage */
.flow-thumb {
  position: absolute; top: 24px; left: 76px;
  width: 132px; height: 196px;
  background: linear-gradient(140deg, #2A2A2A 0%, #3A3A3A 50%, #1F1F1F 100%);
  border-radius: 12px;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 10px 12px;
  font-size: 12px; color: rgba(255,255,255,0.85);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  opacity: 0; transform: scale(0.96) translateY(6px);
  transition: opacity 360ms ease, transform 360ms ease;
}
.flow-thumb.show { opacity: 1; transform: scale(1) translateY(0); }
.flow-thumb .ico { width: 16px; height: 16px; opacity: 0.8; }
.flow-thumb .pct { font-family: 'Google Sans Mono', 'IBM Plex Mono', monospace; font-weight: 600; font-size: 13px; }
.flow-thumb .shimmer {
  position: absolute; inset: 0; border-radius: 12px;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,0.10) 50%, transparent 70%);
  background-size: 220% 100%;
  animation: shimmer-flow 1.6s linear infinite;
  pointer-events: none;
}
@keyframes shimmer-flow { from { background-position: 200% 0; } to { background-position: -100% 0; } }

/* bottom prompt bar */
.flow-prompt {
  margin: 0 auto 22px;
  width: min(720px, calc(100% - 96px));
  background: #1F1F1F; border-radius: 22px;
  padding: 14px 16px 12px;
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  border: 1px solid transparent;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.flow-prompt.focused {
  border-color: rgba(110,58,255,0.55);
  box-shadow: 0 0 0 3px rgba(110,58,255,0.18);
}
.flow-prompt .text {
  font-size: 14px; color: #C0C0C0; min-height: 22px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.flow-prompt .text.placeholder { color: #6B6B6B; }
.flow-prompt .text.typed { color: #E8E8E8; }
.flow-prompt .text .caret {
  display: inline-block; width: 1.5px; height: 14px; background: #fff;
  vertical-align: -2px; margin-left: 1px;
  animation: blink-flow 1s steps(2) infinite;
}
@keyframes blink-flow { 50% { opacity: 0; } }
.flow-prompt .row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.flow-prompt .plus {
  width: 32px; height: 32px; border-radius: 50%;
  background: transparent; color: #E8E8E8;
  display: grid; place-items: center; font-size: 18px; font-weight: 300;
  transition: background 200ms;
}
.flow-prompt .plus.active { background: rgba(110,58,255,0.18); }
.flow-prompt .right { display: flex; align-items: center; gap: 8px; }
.flow-prompt .video-pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  background: #2A2A2A; color: #E8E8E8;
  font-size: 12px; font-weight: 500;
}
.flow-prompt .video-pill .glyph { font-family: 'Google Sans Mono', monospace; opacity: 0.65; font-size: 11px; }
.flow-prompt .arrow {
  width: 32px; height: 32px; border-radius: 50%;
  background: #3A3A3A; color: #E8E8E8;
  display: grid; place-items: center;
  transition: all 200ms;
}
.flow-prompt .arrow.armed { background: #fff; color: #0F0F10; }
.flow-prompt .arrow svg { width: 14px; height: 14px; }
.flow-disclaimer {
  text-align: center; font-size: 11px; color: #6B6B6B;
  padding: 0 16px 14px;
}

/* settings popup — appears above prompt */
.flow-settings {
  position: absolute; right: 56px; bottom: 80px;
  width: 320px;
  background: #1A1A1A; border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 14px; z-index: 5;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.55);
  opacity: 0; transform: translateY(8px) scale(0.97); pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}
.flow-settings.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.flow-settings .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.flow-settings .opt {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; border-radius: 12px;
  background: #2A2A2A; color: #C8C8C8;
  font-size: 12.5px; font-weight: 500;
  transition: all 200ms;
}
.flow-settings .opt.active {
  background: #fff; color: #0F0F10;
}
.flow-settings .opt.armed { box-shadow: 0 0 0 2px rgba(110,58,255,0.65); }
.flow-settings .opt svg { width: 14px; height: 14px; }
.flow-settings .opt.aspect { font-family: 'Google Sans Mono', monospace; font-size: 11px; }
.flow-settings .opt.aspect .glyph { font-size: 12px; }
.flow-settings .row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: #2A2A2A; border-radius: 12px; padding: 4px; }
.flow-settings .row-4 .opt { height: 28px; background: transparent; font-size: 11.5px; border-radius: 9px; }
.flow-settings .row-4 .opt.active { background: #3A3A3A; color: #fff; box-shadow: none; }
.flow-settings .model {
  height: 36px; border-radius: 10px; background: #2A2A2A;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; font-size: 12.5px; color: #C8C8C8;
}
.flow-settings .model .caret { opacity: 0.5; font-size: 9px; }
.flow-settings .row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: #2A2A2A; border-radius: 12px; padding: 4px; }
.flow-settings .row-3 .opt { height: 28px; background: transparent; font-size: 11.5px; border-radius: 9px; }
.flow-settings .row-3 .opt.active { background: #3A3A3A; color: #fff; }
.flow-settings .credits {
  text-align: center; font-size: 11px; color: #6B6B6B; padding-top: 4px;
}
.flow-settings .credits b { color: #C0C0C0; font-weight: 500; text-decoration: underline; text-decoration-style: dotted; }

/* AI cursor over Flow */
.ai-cursor {
  position: absolute; z-index: 30; pointer-events: none;
  width: 24px; height: 24px;
  transform: translate(-2px, -2px);
  transition: top 900ms cubic-bezier(0.34, 1.16, 0.64, 1), left 900ms cubic-bezier(0.34, 1.16, 0.64, 1);
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.45));
}
.ai-cursor svg { width: 100%; height: 100%; }
.ai-cursor .robot-tag {
  position: absolute; top: 24px; left: 22px;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: 'Google Sans Mono', 'IBM Plex Mono', monospace;
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase;
  background: #6E3AFF; color: #fff;
  padding: 4px 8px; border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(110,58,255,0.5);
}
.ai-cursor .robot-tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.35);
  animation: tag-pulse 1.4s ease-in-out infinite;
}
@keyframes tag-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
  50%      { box-shadow: 0 0 0 5px rgba(255,255,255,0); }
}

/* click ripple */
.ai-ripple {
  position: absolute; z-index: 25; pointer-events: none;
  width: 0; height: 0; border-radius: 50%;
  border: 2px solid #6E3AFF;
  transform: translate(-50%, -50%);
  animation: ripple-out 700ms ease-out forwards;
}
@keyframes ripple-out {
  0%   { width: 0; height: 0; opacity: 1; border-width: 3px; }
  100% { width: 60px; height: 60px; opacity: 0; border-width: 1px; }
}

/* ─── Layout: full-bleed simulation ──────────────────────────── */
.sim-shell-v2 {
  background: var(--canvas);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-cinema);
  overflow: hidden;
  position: relative;
}
.sim-grid-v2 {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 620px;
}
.sim-side-v2 {
  border-right: 1px solid var(--line);
  background: var(--paper-warm);
  display: flex; flex-direction: column;
}
.sim-side-v2 .side-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.sim-side-v2 .side-head .title {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ink-3); font-weight: 500;
}
.sim-side-v2 .side-section {
  padding: 14px 14px 16px; border-bottom: 1px solid var(--line);
}
.sim-side-v2 .side-section h5 {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ink-4); font-weight: 600;
  margin: 0 0 10px; padding: 0 4px;
}

/* job queue compact */
.q-list { display: flex; flex-direction: column; gap: 6px; }
.q-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--canvas); border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  transition: all 240ms var(--ease-out-expo);
}
.q-row.active { border-color: var(--violet); background: linear-gradient(180deg, var(--violet-soft) 0%, var(--canvas) 70%); }
.q-row.done { opacity: 0.55; }
.q-row.done .q-title { text-decoration: line-through; text-decoration-color: var(--ink-5); color: var(--ink-3); }
.q-row .q-num { font-family: var(--font-mono); font-size: 9.5px; color: var(--ink-4); width: 16px; }
.q-row .q-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.q-row .q-dot.veo3 { background: var(--violet); }
.q-row .q-dot.grok { background: var(--iris); }
.q-row .q-dot.kling { background: var(--coral); }
.q-row .q-body { flex: 1; min-width: 0; }
.q-row .q-title { font-size: 11.5px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-row .q-meta { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.8px; text-transform: uppercase; color: var(--ink-3); margin-top: 1px; }
.q-row .q-status {
  font-family: var(--font-mono); font-size: 8.5px; font-weight: 600; letter-spacing: 0.8px; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; white-space: nowrap;
}
.q-row .q-status.cho { background: var(--paper-warm); color: var(--ink-4); }
.q-row .q-status.run { background: var(--violet); color: #fff; }
.q-row .q-status.ok { background: var(--ok-soft); color: var(--ok); }

/* steps ticker — micro actions */
.step-ticker { display: flex; flex-direction: column; gap: 2px; }
.step-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 8px;
  font-size: 11.5px; color: var(--ink-3);
  transition: all 200ms ease;
  position: relative;
}
.step-row.done { color: var(--ink-3); }
.step-row.done .step-mark { background: var(--ok); border-color: var(--ok); }
.step-row.done .step-mark::after { content: "✓"; color: #fff; font-size: 9px; font-weight: 700; }
.step-row.active { background: var(--violet-soft); color: var(--ink); font-weight: 500; }
.step-row.active .step-mark { background: var(--violet); border-color: var(--violet); animation: step-pulse 1.2s ease-in-out infinite; }
.step-row.active .step-mark::after { content: ""; width: 4px; height: 4px; background: #fff; border-radius: 50%; }
.step-row.todo { color: var(--ink-4); }
.step-row.todo .step-mark { background: transparent; border-color: var(--line-2); }
.step-row .step-mark {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all 200ms ease;
}
@keyframes step-pulse {
  0%,100% { box-shadow: 0 0 0 0 var(--violet-glow); }
  50%     { box-shadow: 0 0 0 5px transparent; }
}
.step-row .step-text { flex: 1; min-width: 0; line-height: 1.3; }
.step-row .step-text small { display: block; font-family: var(--font-mono); font-size: 9px; color: var(--ink-4); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }

/* big browser — replaces sim-stage */
.sim-stage-v2 {
  display: flex; flex-direction: column;
  background: var(--paper);
}
.sim-stage-v2 .browser-shell {
  flex: 1; margin: 18px;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-cinema);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 0;
  background: #fff;
}
.sim-stage-v2 .url-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: #FAF7F2;
  border-bottom: 1px solid var(--line);
}
.sim-stage-v2 .url-row .nav-btns { display: flex; gap: 4px; color: var(--ink-3); }
.sim-stage-v2 .url-row .nav-btns .btn-circ {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent;
}
.sim-stage-v2 .url-row .nav-btns .btn-circ:hover { background: rgba(0,0,0,0.04); }
.sim-stage-v2 .url-row .url-pill {
  flex: 1; max-width: 720px;
  height: 32px; background: var(--canvas);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0 14px; display: flex; align-items: center; gap: 10px;
  font-family: 'Google Sans Mono', 'IBM Plex Mono', monospace;
  font-size: 12px; color: var(--ink);
}
.sim-stage-v2 .url-row .url-pill .lock { color: var(--ok); }
.sim-stage-v2 .url-row .profile-pill {
  margin-left: auto;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3); letter-spacing: 0.8px;
}
.sim-stage-v2 .url-row .profile-pill b { color: var(--violet); font-weight: 600; }
.sim-stage-v2 .browser-canvas {
  flex: 1; position: relative;
  min-height: 460px;
}

/* footer caption row */
.sim-caption-v2 {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  background: var(--paper-warm);
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.sim-caption-v2 .step-pill {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  letter-spacing: 1.2px;
  background: var(--violet-soft); color: var(--violet);
  padding: 5px 11px; border-radius: 999px;
  white-space: nowrap;
}
.sim-caption-v2 .step-action { color: var(--ink); font-weight: 500; }
.sim-caption-v2 .step-detail { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 14px; }
.sim-caption-v2 .ctrl-btn {
  height: 28px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--canvas);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: 0.6px; color: var(--ink-2);
}
.sim-caption-v2 .ctrl-btn:hover { background: var(--canvas-2); }

@media (max-width: 900px) {
  .sim-grid-v2 { grid-template-columns: 1fr; }
  .sim-side-v2 { border-right: 0; border-bottom: 1px solid var(--line); }
}
