/* Focus-follows-mouse simulation, round 3: windows drawn to look like real
   Mac windows. Themes adjust only the --ffm-* custom properties on .ffm. */
.ffm {
  --ffm-wall: #8fa6c4;
  --ffm-accent: #0a64f0;
  --ffm-track: #ececf0;
  --ffm-text: #1c1c1e;
  --ffm-muted: #5d6068;
  --ffm-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --ffm-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-family: var(--ffm-ui);
}

/* Mode switch: a segmented control */
.ffm-modes { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 10px; background: var(--ffm-track); }
.ffm-mode {
  font: 500 0.9375rem/1.2 var(--ffm-ui); color: var(--ffm-text);
  padding: 0.5rem 0.9rem; border: 0; border-radius: 8px; background: transparent; cursor: pointer;
}
.ffm-mode[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 0 0 0.5px rgba(0, 0, 0, 0.08); }
.ffm-mode:focus-visible { outline: 3px solid var(--ffm-accent); outline-offset: 2px; }
.ffm-hint { margin: 0.75rem 0 0.9rem; min-height: 1.5em; font-size: 1rem; line-height: 1.5; color: var(--ffm-text); }
.ffm-status { margin: 0.75rem 0 0; font-size: 0.9375rem; line-height: 1.5; color: var(--ffm-muted); }
.ffm-status strong { color: var(--ffm-text); }

/* The desktop */
.ffm-desk {
  position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 12px;
  background: var(--ffm-wall); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  user-select: none; -webkit-user-select: none; cursor: default; touch-action: pan-y;
}
.ffm-menubar {
  position: absolute; inset: 0 0 auto 0; z-index: 40; height: 1.5rem;
  display: flex; align-items: center; gap: 1rem; padding-inline: 0.9rem; overflow: hidden; white-space: nowrap;
  background: rgba(255, 255, 255, 0.62); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font-size: 0.8125rem; color: #1c1c1e;
}
.ffm-app { font-weight: 700; }

/* Windows */
.ffm-win {
  position: absolute; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 10px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.28), 0 8px 20px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.16s ease;
}
.ffm-win.is-focused { box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.4), 0 24px 54px rgba(0, 0, 0, 0.42); }
.ffm-bar {
  position: relative; flex: none; height: 1.75rem; display: flex; align-items: center; justify-content: center;
  padding-inline: 3.6rem; background: #f4f4f4; border-bottom: 0.5px solid rgba(0, 0, 0, 0.14);
  font-size: 0.8125rem; font-weight: 700; color: #b4b4b8; cursor: grab; touch-action: none;
}
.ffm-win.is-focused .ffm-bar { background: #ebebeb; color: #3a3a3c; }
.ffm-desk.is-dragging .ffm-bar { cursor: grabbing; }
.ffm-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ffm-lights { position: absolute; left: 0.6rem; top: 50%; transform: translateY(-50%); display: flex; gap: 0.44rem; }
.ffm-lights i { width: 0.72rem; height: 0.72rem; border-radius: 50%; background: #d4d4d6; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12); }
.ffm-win.is-focused .ffm-lights i:nth-child(1) { background: #ff5f57; }
.ffm-win.is-focused .ffm-lights i:nth-child(2) { background: #febc2e; }
.ffm-win.is-focused .ffm-lights i:nth-child(3) { background: #28c840; }

.ffm-body {
  flex: 1; min-height: 0; overflow: hidden; padding: 0.6rem 0.8rem;
  font-size: 0.8125rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: #1c1c1e;
}
.ffm-win[data-id="terminal"] .ffm-bar { background: #3a3a3c; color: #8e8e93; border-bottom-color: #000; }
.ffm-win[data-id="terminal"].is-focused .ffm-bar { background: #444446; color: #e5e5ea; }
.ffm-win[data-id="terminal"] .ffm-lights i { background: #5a5a5e; }
.ffm-win[data-id="terminal"] .ffm-body { font: 0.75rem/1.5 var(--ffm-mono); background: #1e1e1e; color: #e6e6e6; }

.ffm-caret {
  display: none; width: 1.5px; height: 1.15em; margin-left: 1px; vertical-align: text-bottom;
  background: var(--ffm-accent); animation: ffm-blink 1.06s steps(1) infinite;
}
.ffm-win[data-id="terminal"] .ffm-caret { width: 0.55em; background: #c7c7c7; }
.ffm-win.is-focused .ffm-caret { display: inline-block; }
@keyframes ffm-blink { 50% { opacity: 0; } }

/* Self-playing pointer */
.ffm-ghost {
  position: absolute; z-index: 50; width: 16px; height: 24px; margin: -1px 0 0 -1px;
  pointer-events: none; transition: opacity 0.25s ease; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}
.ffm-desk.is-user .ffm-ghost { opacity: 0; }
.ffm-ring { position: absolute; left: -13px; top: -13px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; opacity: 0; }
.ffm-ghost.is-clicking .ffm-ring { animation: ffm-click 0.5s ease-out; }
@keyframes ffm-click { 0% { opacity: 0.95; transform: scale(0.3); } 100% { opacity: 0; transform: scale(1.5); } }

@media (max-width: 640px) {
  .ffm-desk { aspect-ratio: 5 / 6; }
  .ffm-modes { display: flex; flex-direction: column; }
  .ffm-mode { text-align: left; }
  .ffm-menubar span:nth-of-type(n + 3) { display: none; }
  .ffm-bar { justify-content: flex-start; padding-inline: 4.1rem 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ffm-caret { animation: none; }
  .ffm-win { transition: none; }
}

