:root {
  --win-bg: #ffffff;
  --win-border: #bdc3c7;
  --win-header: #ecf0f1;
  --win-shadow: 0 10px 30px rgba(0,0,0,0.3);
  --taskbar-bg: #2c3e50;
  --accent: #3498db;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden; /* Prevent body scroll while dragging */
}

/* The Window Container */
.win-instance {
  position: absolute;
  min-width: 200px;
  min-height: 150px;
  background: var(--win-bg);
  border: 1px solid var(--win-border);
  box-shadow: var(--win-shadow);
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  z-index: 10;
  xxtransition: width 0.15s ease-out, height 0.15s ease-out; /* Smooth snapping */
}

/* Header/Title Bar */
.win-header {
  padding: 10px 15px;
  background: var(--win-header);
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--win-border);
  user-select: none;
}

.win-title {
  font-weight: bold;
  font-size: 14px;
  color: #333;
}

/* Window Buttons */
.win-controls button {
  margin-left: 4px;
  cursor: pointer;
  border: none;
  background: #d5dbdb;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  transition: background 0.2s;
}

.win-controls button:hover { background: #bdc3c7; }
.win-close:hover { background: #e74c3c !important; color: white; }

/* Content Area */
.win-content {
  flex-grow: 1;
  padding: 15px;
  position: relative;
  background: white;
}

/* Resize Handle */
.resizer {
  width: 16px;
  height: 16px;
  position: absolute;
  right: 0;
  bottom: 0;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #bdc3c7 50%);
}

/* Taskbar */
#taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 45px;
  background: var(--taskbar-bg);
  display: flex;
  padding: 0 10px;
  gap: 8px;
  align-items: center;
  z-index: 10000;
}

.task-item {
  background: #34495e;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 2px solid transparent;
}

.task-item:hover { background: #456789; }
.task-item.active { border-bottom: 2px solid var(--accent); }

/* States */
.win-minimized { display: none !important; }
