.window {
  position: absolute;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: 1px 1px 0 #808080, inset 1px 1px 0 #dfdfdf;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  min-height: 100px;
}

.window-focused {
  z-index: 100;
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 18px;
  background: linear-gradient(90deg, #808080, #b5b5b5);
  padding: 2px 2px 1px 3px;
  cursor: var(--cursor-default), default;
  flex-shrink: 0;
  margin: 2px 2px 0 2px;
  border: 1px solid;
  border-color: #dfdfdf #808080 #808080 #dfdfdf;
}

.window-focused .window-titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
}

.window:not(.window-focused) .window-titlebar {
  background: linear-gradient(90deg, #7b7b7b, #9c9c9c);
}

.window-titlebar-text {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding-left: 2px;
}

.window-icon {
  font-size: 12px;
  line-height: 1;
}

.window-title {
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window:not(.window-focused) .window-title {
  color: #e0e0e0;
}

/* ── Resize handles ── */
.window-resize {
  position: absolute;
  z-index: 10;
}
.window-resize-s { bottom: -3px; left: 8px; right: 8px; height: 6px;   cursor: var(--cursor-ns-resize), ns-resize; }
.window-resize-e { top: 8px; bottom: 8px; right: -3px; width: 6px;   cursor: var(--cursor-ew-resize), ew-resize; }
.window-resize-w { top: 8px; bottom: 8px; left: -3px; width: 6px;   cursor: var(--cursor-ew-resize), ew-resize; }
.window-resize-se { bottom: -3px; right: -3px; width: 12px; height: 12px;   cursor: var(--cursor-nwse-resize), nwse-resize; }
.window-resize-sw { bottom: -3px; left: -3px; width: 12px; height: 12px;   cursor: var(--cursor-nesw-resize), nesw-resize; }

body.window-resizing {
  cursor: inherit;
}
body.window-resizing * {
  user-select: none;
}

.window-controls {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  align-items: center;
}

.window-btn {
  width: 16px;
  height: 14px;
  font-size: 9px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
  cursor: var(--cursor-pointer), pointer;
  color: #000;
  padding: 0 1px 1px 0;
  line-height: 1;
  font-family: 'Marlett', 'MS Sans Serif', Arial, sans-serif;
  outline: none;
  box-sizing: border-box;
}

.window-btn:hover {
  background: #c8c8c8;
}

.window-btn:active {
  border-color: #000000 #ffffff #ffffff #000000;
  box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
  padding: 1px 0 0 1px;
}

.window-btn-min {
  font-size: 8px;
  padding-bottom: 2px;
}

.window-btn-max {
  font-size: 7px;
  padding-bottom: 1px;
}

.window-btn-close {
  font-size: 8px;
  margin-left: 2px;
  font-weight: bold;
}

.window-btn-close:hover {
  background: #e00000;
  color: #fff;
  border-color: #ff8888 #880000 #880000 #ff8888;
}

.window-btn-close:active {
  background: #b00000 !important;
  border-color: #880000 #ff8888 #ff8888 #880000 !important;
}

.window-content {
  flex: 1;
  overflow: auto;
  background: #ffffff;
  border: 2px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  box-shadow: inset 1px 1px 0 #000;
  margin: 2px 3px 3px 3px;
  position: relative;
}

.window-content::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.window-content::-webkit-scrollbar-track {
  background: #0a0a0a;
  border: 1px solid #222;
}

.window-content::-webkit-scrollbar-thumb {
  background: #333;
  border: 1px solid #444;
}

.window-content::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.explorer-content {
  padding: 4px;
}

.explorer-loading,
.explorer-empty {
  color: #666;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  text-align: center;
  padding: 30px 10px;
}

.explorer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  cursor: var(--cursor-pointer), pointer;
  border: 1px solid transparent;
}

.explorer-item:hover {
  background: #1a1a2a;
  border-color: #334;
}

.explorer-item-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.explorer-item-name {
  font-size: 12px;
  color: #c0c0c0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-viewer {
  margin: 8px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  color: #c0c0c0;
  line-height: 1.4;
}

.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: #c0c0c0;
  border-top: 2px solid #ffffff;
  box-shadow: inset 0 1px 0 #dfdfdf;
  display: flex;
  align-items: center;
  padding: 2px 4px;
  z-index: 5000;
  gap: 3px;
}

.taskbar-start {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: bold;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
  cursor: var(--cursor-pointer), pointer;
  color: #000;
}

.taskbar-start:hover {
  background: #c8c8c8;
  color: #000;
}

.taskbar-start:active,
.taskbar-start--active {
  border-color: #000000 #ffffff #ffffff #000000;
  box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
  color: #000;
}

.taskbar-start-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.taskbar-divider {
  width: 2px;
  height: 20px;
  border-left: 1px solid #808080;
  border-right: 1px solid #ffffff;
  margin: 0 2px;
  flex-shrink: 0;
}

.taskbar-windows {
  flex: 1;
  display: flex;
  gap: 3px;
  overflow: hidden;
  min-width: 0;
}

.taskbar-btn {
  height: 22px;
  padding: 0 8px;
  font-size: 11px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: inset 1px 1px 0 #dfdfdf, inset -1px -1px 0 #808080;
  cursor: var(--cursor-pointer), pointer;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
  flex-shrink: 1;
  text-align: left;
}

.taskbar-btn:hover {
  background: #c8c8c8;
  color: #000;
}

.taskbar-btn:active,
.taskbar-btn.active {
  border-color: #000000 #ffffff #ffffff #000000;
  box-shadow: inset -1px -1px 0 #dfdfdf, inset 1px 1px 0 #808080;
  color: #000;
}

.taskbar-btn-minimized {
  font-style: italic;
  color: #404040;
}

.taskbar-tray {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid;
  border-color: #808080 #ffffff #ffffff #808080;
  background: #c0c0c0;
  flex-shrink: 0;
}

.taskbar-clock {
  font-size: 11px;
  color: #000;
}

.start-menu {
  position: absolute;
  bottom: 30px;
  left: 4px;
  width: 220px;
  background: #c0c0c0;
  border: 2px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  box-shadow: inset 1px 1px 0 #dfdfdf, 2px 2px 6px rgba(0, 0, 0, 0.4);
  z-index: 6000;
  display: flex;
  flex-direction: row;
  font-size: 11px;
  animation: start-menu-in 0.1s ease-out;
  padding-left: 26px;
}

@keyframes start-menu-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.start-menu-header {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 22px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 6px 2px;
  background: linear-gradient(180deg, #1084d0, #000080);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.start-menu-header-icon {
  display: none;
}

.start-menu-header-title {
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.4);
}

.start-menu-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px;
  gap: 0;
}

.start-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 10px;
  background: transparent;
  border: none;
  cursor: var(--cursor-pointer), pointer;
  color: #000;
  font-size: 11px;
  text-align: left;
}

.start-menu-item:hover {
  background: #000080;
  color: #fff;
}

.start-menu-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  object-fit: contain;
}

.start-menu-item-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.start-menu-sep {
  height: 2px;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #ffffff;
  margin: 3px 4px;
}

.taskbar-toast {
  position: absolute;
  bottom: 38px;
  right: 8px;
  background: #ffffe1;
  border: 1px solid #000;
  color: #000;
  font-size: 11px;
  padding: 6px 12px;
  z-index: 6500;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.taskbar-toast.visible {
  opacity: 1;
  transform: translateY(0);
}


.dialog-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 8000;
}

.dialog-window {
  background: #ece9d8;
  border: 2px solid;
  border-color: #ffffff #404040 #404040 #ffffff;
  min-width: 320px;
  max-width: 450px;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
}

.dialog-titlebar {
  background: linear-gradient(90deg, #1a0000, #4a0000);
  color: #ff4444;
  font-size: 12px;
  font-weight: bold;
  padding: 4px 8px;
}

.dialog-body {
  display: flex;
  gap: 12px;
  padding: 16px;
  align-items: flex-start;
}

.dialog-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
}

.dialog-icon-error {
  background: #cc0000;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.dialog-icon-warning {
  background: #ffcc00;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.dialog-icon-info {
  width: 32px;
  height: 32px;
  border: 2px solid #880000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cc0000;
  font-weight: bold;
  font-size: 18px;
}

.dialog-icon-info::after {
  content: 'i';
}

.dialog-icon-question {
  width: 32px;
  height: 32px;
  border: 2px solid #880000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cc0000;
  font-weight: bold;
  font-size: 18px;
}

.dialog-icon-question::after {
  content: '?';
}

.dialog-message {
  font-size: 12px;
  color: #000;
  line-height: 1.5;
  white-space: pre-wrap;
}

.dialog-buttons {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px 12px;
}

.dialog-btn {
  min-width: 75px;
  min-height: 24px;
  font-size: 12px;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  padding: 3px 12px;
  cursor: var(--cursor-pointer), pointer;
  white-space: nowrap;
}

.dialog-btn:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.dialog-btn-default {
  outline: 1px dotted #000;
  outline-offset: -3px;
}

/* ── ENTITY CHAT ── */
.entity-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0a0a0a;
  border: 1px solid #1a1a1a;
}
.entity-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.entity-chat-msg {
  align-self: flex-start;
  max-width: 80%;
  background: #1a0a0a;
  border: 1px solid #3a1a1a;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  color: #cc6666;
  font-family: 'Courier New', monospace;
  white-space: pre-wrap;
  word-break: break-all;
  animation: entityFadeIn 0.3s ease-out;
}
.entity-chat-msg--self {
  align-self: flex-end;
  background: #0a0a1a;
  border-color: #1a1a3a;
  color: #6666aa;
}
@keyframes entityFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.window-glitch-chat {
  animation: chatGlitch 0.4s steps(2);
}
@keyframes chatGlitch {
  0% { filter: hue-rotate(0deg) brightness(1); }
  25% { filter: hue-rotate(90deg) brightness(1.3); transform: translate(2px, -1px); }
  50% { filter: hue-rotate(180deg) brightness(0.8); transform: translate(-1px, 1px); }
  75% { filter: hue-rotate(270deg) brightness(1.2); transform: translate(1px, 0px); }
  100% { filter: hue-rotate(0deg) brightness(1); }
}

.notification-container {
  position: absolute;
  bottom: 36px;
  right: 8px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}

.notification-toast {
  width: 280px;
  background: #ffffe1;
  border: 1px solid #000;
  color: #000;
  font-size: 11px;
  box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  cursor: var(--cursor-pointer), pointer;
  position: relative;
  overflow: hidden;
}

.notification-toast.visible {
  opacity: 1;
  transform: translateX(0);
}

.notification-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #ff0000;
  animation: notif-bar-pulse 1s ease-in-out infinite;
}

@keyframes notif-bar-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.notification-toast:hover {
  box-shadow: 2px 2px 10px rgba(200,0,0,0.3);
  border-color: #880000;
}

.notification-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(90deg, #8a0000, #cc2222);
  color: #fff;
  padding: 3px 4px;
  font-weight: bold;
  font-size: 11px;
}

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

.notification-close {
  width: 16px;
  height: 14px;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #c0c0c0;
  border: 1px solid;
  border-color: #ffffff #000000 #000000 #ffffff;
  cursor: var(--cursor-pointer), pointer;
  color: #000;
  flex-shrink: 0;
  margin-left: 6px;
}

.notification-close:hover {
  background: #e00000;
  color: #fff;
  border-color: #ff8888 #880000 #880000 #ff8888;
}

.notification-body {
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: #000;
}
