/* retoor <retoor@molodetz.nl> */

.fw-host {
  --fw-bg: #000000;
  --fw-fg: #d0d0d0;
  --fw-dim: #6a737d;
  --fw-accent: #3fb950;
  --fw-bar-bg: #0b0b0b;
  --fw-border: #1c1f24;
  --fw-hover-bg: #1b1f25;
  --fw-shadow: 0 18px 60px rgba(0, 0, 0, 0.6);
  --fw-radius: 10px;
  --fw-font: "SFMono-Regular", "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
  --fw-font-size: 14px;
  --fw-z: var(--z-chrome-fw);

  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--fw-z);
  font-family: var(--fw-font);
  font-size: var(--fw-font-size);
}

.fw-host .fw-window {
  position: fixed;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 320px;
  min-height: 220px;
  max-width: 100vw;
  max-height: 100vh;
  background: var(--fw-bg);
  color: var(--fw-fg);
  border: 1px solid var(--fw-border);
  border-radius: var(--fw-radius);
  box-shadow: var(--fw-shadow);
  line-height: 1.5;
  animation: fw-pop 0.16s ease;
  transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease;
}

@keyframes fw-pop {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.fw-host.fw-dragging .fw-window {
  transition: none;
  user-select: none;
}

.fw-host.fw-state-normal .fw-titlebar {
  cursor: move;
}

.fw-host .fw-resize {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  z-index: 6;
  cursor: nwse-resize;
  pointer-events: auto;
  background-image: linear-gradient(135deg, transparent 0 46%, var(--fw-dim) 46% 54%,
    transparent 54% 66%, var(--fw-dim) 66% 74%, transparent 74%);
  opacity: 0.55;
}
.fw-host.fw-state-normal .fw-resize {
  display: block;
}

.fw-host.fw-state-maximized .fw-window {
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  width: auto;
  height: auto;
  resize: none;
}

.fw-host.fw-state-fullscreen .fw-window {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 0;
  resize: none;
}

/* On-screen keyboard inset: visualViewport sets inline top/height from
   FloatingWindow.js so the window shrinks above the keyboard instead of
   being pushed off-screen. Drop the fixed bottom/height so the inline wins. */
.fw-host.fw-state-fullscreen.fw-keyboard-visible .fw-window,
.fw-host.fw-state-maximized.fw-keyboard-visible .fw-window {
  bottom: auto;
  transition: none;
}

.fw-host .fw-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  background: var(--fw-bar-bg);
  border-bottom: 1px solid var(--fw-border);
  flex: 0 0 auto;
  user-select: none;
}

.fw-host .fw-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--fw-accent);
  font-weight: bold;
  letter-spacing: 0.5px;
}

.fw-host .fw-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fw-host .fw-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--fw-accent);
}

.fw-host .fw-winctl {
  flex: 0 0 auto;
}

.fw-host .fw-winctl button {
  background: transparent;
  color: var(--fw-dim);
  border: none;
  width: 28px;
  height: 24px;
  margin-left: 2px;
  border-radius: 5px;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.fw-host .fw-winctl button[hidden] {
  display: none;
}

.fw-host .fw-winctl button:hover {
  color: var(--fw-fg);
  background: var(--fw-hover-bg);
}

.fw-host .fw-winctl button[data-win="close"]:hover {
  background: var(--danger);
  color: var(--white);
}

.fw-host .fw-body {
  flex: 1 1 auto;
  overflow: hidden;
  position: relative;
}

/* Mobile: only close is available; window is forced fullscreen by JS */
.fw-host.fw-mobile .fw-winctl button[data-win="minimize"],
.fw-host.fw-mobile .fw-winctl button[data-win="normalize"],
.fw-host.fw-mobile .fw-winctl button[data-win="maximize"],
.fw-host.fw-mobile .fw-winctl button[data-win="fullscreen"] {
  display: none;
}

/* Container terminal body */
.ct-body {
  background: var(--fw-bg);
}
.ct-status {
  padding: 6px 10px;
  color: var(--fw-dim);
  font-size: 12px;
}
.ct-xterm {
  position: absolute;
  inset: 0;
  padding: 4px 2px 4px 6px;
}
.ct-xterm .xterm {
  height: 100%;
}
