.window {
  position: absolute;
  min-width: 320px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--glass-strong);
  backdrop-filter: blur(var(--blur)) saturate(170%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(170%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg);
  will-change: transform, opacity;
  animation: winOpen 220ms cubic-bezier(0.2, 0.9, 0.3, 1.15);
}

@keyframes winOpen {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.window.closing {
  animation: winClose 180ms ease forwards;
}

@keyframes winClose {
  to {
    transform: scale(0.9);
    opacity: 0;
  }
}

.window.minimizing {
  animation: winMin 220ms ease forwards;
}

@keyframes winMin {
  to {
    transform: translateY(30vh) scale(0.5);
    opacity: 0;
  }
}

.window.active {
  border-color: var(--stroke-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px color-mix(in oklab, var(--accent) 45%, transparent),
    0 0 44px color-mix(in oklab, var(--accent) 22%, transparent);
}

.window.maximized {
  border-radius: 0;
}

.titlebar {
  height: 38px;
  flex: 0 0 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0));
  cursor: grab;
  touch-action: none;
}

.titlebar.dragging {
  cursor: grabbing;
}

.traffic {
  display: flex;
  gap: 12px;
  align-items: center;
}

.tl {
  position: relative;
  width: 16px;
  height: 16px;
  min-width: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.22);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.55);
  line-height: 1;
  transition: filter 120ms ease;
}

.tl::before {
  content: "";
  position: absolute;
  inset: -7px;
  border-radius: 50%;
}

.tl:hover {
  filter: brightness(1.15);
}

.tl-close {
  background: #ff5f57;
}
.tl-min {
  background: #febc2e;
}
.tl-max {
  background: #28c840;
}

.tl-glyph {
  opacity: 0;
  transition: opacity 120ms ease;
}

.traffic:hover .tl-glyph {
  opacity: 1;
}

.win-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0.92;
  pointer-events: none;
  margin: 0 auto;
  padding-right: 62px;
}

.win-title .wt-icon {
  font-size: 15px;
}

.win-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  position: relative;
}

.win-body > * {
  min-width: 0;
}

.resize-handle {
  position: absolute;
  touch-action: none;
  z-index: 6;
}

.rh-n {
  top: -3px;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}
.rh-s {
  bottom: -3px;
  left: 10px;
  right: 10px;
  height: 8px;
  cursor: ns-resize;
}
.rh-w {
  left: -3px;
  top: 10px;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}
.rh-e {
  right: -3px;
  top: 10px;
  bottom: 10px;
  width: 8px;
  cursor: ew-resize;
}
.rh-nw {
  left: -3px;
  top: -3px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
}
.rh-ne {
  right: -3px;
  top: -3px;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}
.rh-sw {
  left: -3px;
  bottom: -3px;
  width: 14px;
  height: 14px;
  cursor: nesw-resize;
}
.rh-se {
  right: -3px;
  bottom: -3px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
}

.rh-se::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--stroke-strong);
  border-bottom: 2px solid var(--stroke-strong);
  border-bottom-right-radius: 3px;
}
