body {
  margin: 0;
  height: 100vh;
  background: radial-gradient(#111, #000);
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
}

.window,
.taskbar,
.start-menu {
  cursor: default;
}

button {
  cursor: pointer;
}

@media (max-width: 768px) {
  body {
    display: block;
    height: auto;
    min-height: 100vh;
    background: #000;
  }

  .viewport {
    display: block !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    min-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
    background: transparent !important;
  }

  .desktop {
    display: flex;
    flex-direction: column;
    padding: 15px !important;
    gap: 20px;
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    background: transparent !important;
  }

  .desktop::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: url('../assets/wallper.webp') center center / cover no-repeat;
    z-index: -1;
  }

  .mobile-lang-selector {
    display: flex !important;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
    margin-bottom: -5px;
    z-index: 100;
  }

  .lang-btn {
    background: linear-gradient(#245edc, #1e4db7);
    color: white;
    border: 1px solid #11388f;
    border-radius: 4px;
    padding: 6px 14px;
    font-family: Tahoma, sans-serif;
    font-size: 14px;
    font-weight: bold;
    box-shadow: inset 0 1px #4d7cff, 2px 2px 5px rgba(0,0,0,0.5);
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
    cursor: pointer;
  }

  .desktop-icon, .taskbar, .start-menu, .resize-handle {
    display: none !important;
  }

  .title-bar-controls button {
    display: none !important;
  }

  .window {
    box-sizing: border-box;
  }

  #profileWindow, #aboutWindow, #projectsWindow {
    position: static !important;
    display: flex !important;
    flex-direction: column;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    transform: none !important;
    opacity: 0;
  }

  body.loaded #profileWindow {
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.1s;
  }

  body.loaded #aboutWindow {
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.3s;
  }

  body.loaded #projectsWindow {
    animation: fadeInUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: 0.5s;
  }

  #screenshotViewerWindow {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    bottom: 10px !important;
    width: auto !important;
    height: auto !important;
    z-index: 99999 !important;
  }

  #screenshotViewerWindow .title-bar-controls button {
    display: block !important;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .mobile-footer {
    display: block;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-family: Tahoma, sans-serif;
    font-size: 11px;
    padding: 30px 0 20px 0;
    margin-top: auto;
    text-shadow: 1px 1px 2px #000;
  }

  .profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .projects-container {
    flex-direction: column;
    height: auto !important;
  }

  .projects-grid {
    flex: none;
    width: 100%;
    max-width: 100%;
    border-right: none;
    border-bottom: 2px solid #808080;
    max-height: 250px;
  }

  #projectsWindow {
    height: auto !important;
    min-height: 400px;
  }

  #projectsWindow .window-body {
    height: auto !important;
    overflow: visible !important;
  }
}


.viewport {
  width: min(1280px, 95vw);
  height: min(1000px, 95vh);
  background: #000;
  padding: 18px;
  border-radius: 18px;
  box-shadow:
    0 0 0 4px #222,
    0 0 0 8px #444,
    0 30px 60px rgba(0,0,0,.8);
}

.desktop {
  width: 100%;
  height: 100%;
  background: url("../assets/wallper.webp") center / cover no-repeat;
  position: relative;
  overflow: hidden;
}

.desktop-icon {
  width: 80px;
  margin: 20px;
  cursor: default;
  color: white;
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
  font-family: "Tahoma", sans-serif;
  font-size: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.desktop-icon img {
  width: 48px;
  margin-bottom: 4px;
}

.desktop-icon::after {
  content: "";
  display: block;
  position: absolute;

  left: 16px;
  top: 35px;

  width: 16px;
  height: 12px;
  background-image: url('../assets/icons/arrow.png');
  background-size: contain;
  background-repeat: no-repeat;

  z-index: 10;
  pointer-events: none;
}

.mobile-lang-selector {
  display: none;
}

.mobile-footer {
  display: none;
}

.desktop-icon.selected span {
  background-color: #0b58cf;
  color: white;
  outline: 1px dotted rgba(255, 255, 255, 0.6);
}

.desktop-icon.selected img {
  filter: brightness(0.6) sepia(1) hue-rotate(200deg) saturate(3);
}

.window {
  position: absolute;
}

.resize-handle {
  position: absolute;
  background: none;
  pointer-events: all;
  z-index: 100;
}

/* Corner handles */
.resize-nw {
  top: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}

.resize-ne {
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}

.resize-sw {
  bottom: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}

.resize-se {
  bottom: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}

/* Edge handles */
.resize-n {
  top: -4px;
  left: 12px;
  right: 12px;
  height: 12px;
  cursor: ns-resize;
}

.resize-s {
  bottom: -4px;
  left: 12px;
  right: 12px;
  height: 12px;
  cursor: ns-resize;
}

.resize-w {
  top: 12px;
  left: -4px;
  width: 12px;
  bottom: 12px;
  cursor: ew-resize;
}

.resize-e {
  top: 12px;
  right: -4px;
  width: 12px;
  bottom: 12px;
  cursor: ew-resize;
}

.window-body {
  font-size: 13px;
}


#profileWindow {
  display: none
}

#aboutWindow {
  display: none
}

#projectsWindow {
  display: none
}

/* Medium screens - adjust window positions and sizes */
@media (max-width: 1024px) and (min-width: 769px) {
  /* Sizes dynamically calculated by JavaScript */
}

#projectsWindow .window-body {
  height: calc(100% - 55px);
  overflow-y: auto;
  padding: 8px;
}

#projectsWindow .window-body::-webkit-scrollbar {
  width: 12px;
}

#projectsWindow .window-body::-webkit-scrollbar-thumb {
  background: #c0c0c0;
  border: 2px solid #fff;
}

#projectsWindow .window-body::-webkit-scrollbar-track {
  background: #e1e1e1;
}

/* Profile */
.profile {
  display: flex;
  gap: 12px;
}

.profile h1 {
  margin: 0;
  padding: 0;
  font-size: inherit;
  font-weight: inherit;
  display: inline;
}

.profile h1 strong {
  font-weight: bold;
}

.avatar {
  width: 152px;
  height: 152px;
  border: 1px solid #000;
}

/* Notepad */
.notepad {
  padding: 4px 4px 2px 4px;
  word-wrap: break-word;
  font-family: "Courier New", monospace;
  color: #2b2626;
  font-size: 13px;
  box-sizing: border-box;
  overflow-y: auto;
  display: block;
}

.notepad span {
  display: inline;
}

/* Social links in About window */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 4px 0;
  border-top: 1px solid #808080;
  box-shadow: inset 0 1px 0 #ffffff;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #ece9d8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  box-sizing: border-box;
}

.social-link:hover {
  border-color: #808080 #ffffff #ffffff #808080;
  background: #f5f1e8;
}

.social-link img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  display: block;
}

/* Projects - Folder View */
.projects-folder {
  background: #ece9d8;
  padding: 0;
  height: calc(100% - 55px);
  display: flex;
  flex-direction: column;
}

.projects-container {
  display: flex;
  height: 100%;
  gap: 0;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
  list-style: none;
  padding: 12px;
  margin: 0;
  overflow-y: auto;
  flex: 0 0 280px; /* Фиксированная базовая ширина решает баг схлопывания сетки в Firefox из-за автоматического расчета flex-basis */
  border-right: 2px solid #808080;
  align-content: flex-start;
}

.projects-divider {
  width: 2px;
  background: #808080;
  box-shadow: inset 1px 0 #fff;
}

.projects-preview {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: #ece9d8;
  display: flex;
  flex-direction: column;
}

.preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #808080;
  font-size: 12px;
  text-align: center;
  padding: 20px;
}

.preview-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #c0c0c0;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.preview-image-container.mobile {
  aspect-ratio: 9 / 16;
  max-width: 300px;
  margin: 0 auto;
  padding: 12px;
  background: #c0c0c0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.preview-image-container .preview-image {
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.preview-image-container.mobile .preview-image {
  overflow: hidden;
}

.preview-image {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.preview-controls {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.6);
}

.preview-nav-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  background: #c0c0c0;
  border: 2px outset #dfdfdf;
  border-right-color: #808080;
  border-bottom-color: #808080;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-nav-btn:active {
  border-style: inset;
}

.preview-counter {
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.8);
  padding: 2px 6px;
  border-radius: 2px;
  min-width: 40px;
  text-align: center;
}

.preview-title {
  font-size: 14px;
  font-weight: bold;
  color: #000;
  word-break: break-word;
}

.preview-type {
  font-size: 11px;
  color: #666;
  padding: 4px 8px;
  background: #c0c0c0;
  border: 1px solid #808080;
  border-radius: 2px;
  display: inline-block;
}

.preview-description {
  font-size: 12px;
  color: #000;
  line-height: 1.4;
  padding: 8px;
  background: #f0f0f0;
  border: 1px solid #c0c0c0;
  border-radius: 2px;
}

.preview-button {
  padding: 4px 12px;
  align-self: flex-start;
  font-size: 12px;
}

.project-thumbnail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  text-align: center;
  padding: 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.project-thumbnail:hover {
  background: #c0d8ff;
  outline: 1px dotted #000;
}

.project-thumbnail:active {
  background: #a8c5ff;
}

.project-thumbnail.selected {
  background: #a8c5ff;
  outline: 1px dotted #000;
}

.project-thumbnail-image {
  width: 96px;
  height: 96px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid #808080;
  background-color: #ffffff;
  flex-shrink: 0;
}

.project-thumbnail-name {
  font-size: 11px;
  font-family: Tahoma, sans-serif;
  word-wrap: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-width: 110px;
  color: #000;
  font-weight: 500;
}


.cursor {
  display: inline;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}


.taskbar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  background: linear-gradient(#245edc, #1e4db7);
  display: flex;
  align-items: center;
  padding: 2px;
  gap: 4px;
  box-shadow: inset 0 1px #4d7cff;
}

.start-button {
  height: 28px;
  padding: 0 12px;
  font-weight: bold;
  background: #1da502;
  color: #ffffff;
  font-size: 1rem;
}

.taskbar-windows {
  display: flex;
  gap: 4px;
  flex: 1;
}

.taskbar-window-btn {
  height: 28px;
  padding: 0 10px;
  background: #e1e1e1;
  border: 1px solid #808080;
  font-size: 12px;
  cursor: pointer;
}

.taskbar-window-btn.active {
  background: #c0d8ff;
}

.taskbar-clock {
  width: 60px;
  text-align: center;
  font-size: 12px;
  background: #e1e1e1;
  border: 1px solid #808080;
  padding: 4px;
}

.start-menu {
  position: relative;
  display: inline-block;
  bottom: 14rem;
  left: 2px;
  width: 220px;
  background: #e1e1e1;
  border: 2px solid #808080;
  box-shadow: 2px 2px 0 #000;
  display: none;
  z-index: 9999;
}

.start-header {
  background: linear-gradient(#245edc, #1e4db7);
  color: white;
  padding: 6px;
  font-weight: bold;
}

.start-menu button {
  width: 100%;
  border: none;
  background: none;
  padding: 6px;
  text-align: left;
  cursor: pointer;
  font-family: Tahoma, sans-serif;
}

.start-menu button:hover {
  background: #c0d8ff;
}

.start-menu hr {
  margin: 4px;
  border: none;
  border-top: 1px solid #999;
}

.start-menu-item.has-submenu {
  position: relative;
}

.start-menu-item.has-submenu .submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  width: 150px;
  background: #e1e1e1;
  border: 2px solid #808080;
  box-shadow: 2px 2px 0 #000;
  z-index: 10000;
}

.start-menu-item.has-submenu:hover .submenu {
  display: block;
}


#loader {
  z-index: 100;
}

/* Screenshot Viewer styles */
.preview-image {
  cursor: pointer;
  transition: filter 0.15s ease-in-out;
}

.preview-image:hover {
  filter: brightness(1.05);
}

#screenshotViewerWindow .window-body {
  height: calc(100% - 40px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 6px;
  overflow: hidden;
}

.screenshot-viewer-title-header {
  font-weight: bold;
  margin-bottom: 5px;
  text-align: center;
  font-family: Tahoma, sans-serif;
  font-size: 13px;
  color: #000;
}

.screenshot-viewer-image-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #c0c0c0;
  overflow: hidden;
  border: 2px inset #808080;
  box-sizing: border-box;
}

.screenshot-viewer-image-container img {
  max-width: 100%;
  max-height: 100%;
  min-width: 0;
  min-height: 0;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}

.screenshot-viewer-image-container.zoomed {
  cursor: grab;
}

.screenshot-viewer-image-container.zoomed.dragging {
  cursor: grabbing;
}

/* Zoom control bar */
.screenshot-viewer-zoombar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  margin-bottom: 4px;
  background: #ece9d8;
  border: 1px inset #808080;
}

.screenshot-viewer-zoombar button {
  min-width: 26px;
  padding: 2px 8px;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  font-weight: bold;
  background: #ece9d8;
  border: 2px solid;
  border-color: #ffffff #808080 #808080 #ffffff;
  cursor: pointer;
}

.screenshot-viewer-zoombar button:active {
  border-color: #808080 #ffffff #ffffff #808080;
}

.screenshot-zoom-label {
  min-width: 44px;
  text-align: center;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  background: #ffffff;
  border: 1px inset #808080;
  padding: 2px 4px;
  color: #000;
}

.screenshot-viewer-description {
  margin-top: 6px;
  padding: 6px;
  border: 2px inset #ffffff; /* inset border typical of XP fields */
  background: #ffffff;
  min-height: 45px;
  max-height: 90px;
  overflow-y: auto;
  font-family: Tahoma, sans-serif;
  font-size: 12px;
  color: #000;
  box-sizing: border-box;
  text-align: left;
}

/* Стилизация скроллбара описания под стиль XP */
.screenshot-viewer-description::-webkit-scrollbar {
  width: 16px;
}
.screenshot-viewer-description::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, #eeeeee, #cccccc, #eeeeee);
  border: 1px solid #808080;
  box-shadow: inset 1px 1px 0 #ffffff;
}
.screenshot-viewer-description::-webkit-scrollbar-track {
  background: #dfdfdf;
  border-left: 1px solid #808080;
}

/* Project Tags styles */
.preview-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  margin-bottom: 8px;
}

.tag-badge {
  font-family: Tahoma, sans-serif;
  font-size: 11px;
  padding: 2px 6px;
  background: #ece9d8; /* matching XP window color */
  border: 1px solid #808080;
  border-radius: 2px;
  color: #000;
  box-shadow: inset 1px 1px 0 #ffffff;
}

/* Цветовые схемы тегов в стиле Windows XP/Vista */
.tag-badge.tag-scheme-0 {
  background: #e6f0fa; /* Luna Blue Soft */
  border-color: #7da2ce;
  color: #1d5288;
}

.tag-badge.tag-scheme-1 {
  background: #f0f4ea; /* Olive Green Soft */
  border-color: #b2c2a3;
  color: #556644;
}

.tag-badge.tag-scheme-2 {
  background: #f2f2f4; /* Metallic Silver Soft */
  border-color: #b0b0b8;
  color: #4a4a50;
}

.tag-badge.tag-scheme-3 {
  background: #fff5e6; /* Soft Orange/Gold warning color */
  border-color: #e6a86c;
  color: #a05a2c;
}

.tag-badge.tag-scheme-4 {
  background: #e1f5fe; /* Vista Aero Blue Soft */
  border-color: #81d4fa;
  color: #0277bd;
}

.tag-badge.tag-scheme-5 {
  background: #e8f5e9; /* Vista Aero Green Soft */
  border-color: #a5d6a7;
  color: #2e7d32;
}



