* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@font-face {
  font-family: 'MS-Sans-Serif';
  src: url('../../resources/font/ms-sans-serif-1.otf.woff2') format('woff2'),
       url('../../resources/font/ms-sans-serif-1.ttf') format('truetype');
}

body {
  background: #000000;
  min-height: 100vh;
  font-family: 'MS-Sans-Serif', 'Courier New', 'VT323', 'Press Start 2P', monospace;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 1rem;
  padding: 1rem;
  overflow: hidden;
  user-select: none;
}

.wallpaper-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wallpaper-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.desktop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  width: 100%;
  height: 100vh;
  padding: 0.1rem;
  overflow-y: auto;
  overflow-x: hidden;
}

.desktop-icons {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.1rem;
  height: calc(100vh - 0.2rem);
  width: max-content;
  min-width: 100%;
}

.app-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #1fcc1f;
  transition: 0.08s linear;
  image-rendering: pixelated;
  padding: 0.3rem;
  border: 2px solid transparent;
  background: transparent;
  width: auto;
  min-width: 90px;
  flex-shrink: 0;
}

.app-item:hover,
.app-item:focus-visible {
  background: #0a0a0a;
  border: 2px dashed #1fcc1f;
  outline: none;
  cursor: pointer;
  transform: scale(1.05);
}

.icon-wrapper {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.3rem;
  background: #030303;
  border: 2px solid #1fcc1f;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.game-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  display: block;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

.fallback-icon {
  display: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #1fcc1f;
}

.game-icon.error-fallback {
  display: none;
}

.game-icon.error-fallback + .fallback-icon {
  display: block;
}

.app-label {
  font-size: 0.8rem;
  font-weight: bold;
  text-align: center;
  background: #000;
  padding: 0.1rem 0.3rem;
  border: 1px solid #1fcc1f;
  text-transform: uppercase;
  color: #1fcc1f;
}

.windows-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.window {
  position: absolute;
  width: 600px;
  height: 450px;
  min-width: 300px;
  min-height: 200px;
  background: #000;
  border: 2px solid #1fcc1f;
  display: flex;
  flex-direction: column;
  pointer-events: all;
  box-shadow: 0 0 0 2px #000, 0 0 20px rgba(31, 204, 31, 0.2);
  z-index: 100;
  animation: windowOpen 0.15s ease-out;
}

.window.active {
  z-index: 200;
  border-color: #3dff3d;
}

.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0a0a0a;
  border-bottom: 1px solid #1fcc1f;
  padding: 0.2rem 0.3rem;
  cursor: move;
  height: 24px;
  flex-shrink: 0;
}

.window-title {
  font-size: 0.81rem;
  color: #1fcc1f;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.window-controls {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.win-btn {
  width: 18px;
  height: 18px;
  background: #000;
  border: 1px solid #1fcc1f;
  color: #1fcc1f;
  font-family: inherit;
  font-size: 0.77rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: 0.05s;
}

.win-btn:hover {
  background: #1a3a1a;
}

.win-btn:active {
  background: #1fcc1f;
  color: #000;
}

.win-close:hover {
  background: #330000;
  border-color: #ff4444;
  color: #ff4444;
}

.win-close:active {
  background: #ff4444;
  color: #000;
}

.window-content {
  flex: 1;
  overflow: hidden;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-content iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #000;
  object-fit: contain;
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 50%, #1fcc1f 50%);
  opacity: 0.5;
  z-index: 10;
}

.resize-handle:hover {
  opacity: 1;
}

.window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  min-height: 100% !important;
  border: none;
}

.window.maximized .resize-handle {
  display: none;
}

.resize-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  cursor: nwse-resize;
  display: none;
}

.resize-overlay.active {
  display: block;
}

@keyframes windowOpen {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}