@font-face {
  font-family: 'Pixel';
  src: url('../assets/CCTV.ttf') format('truetype');
}

:root {
  --shortcut-size: clamp(80px, 10vw, 120px);
  --icon-size: clamp(24px, 3vw, 48px);
  --padding-size: clamp(8px, 1.5vw, 14px);
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: black;
  color: white;
  font-family: 'Pixel', monospace;
  overflow: hidden;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}

#desktop {
  width: 100vw;
  height: 100vh;
  position: relative;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  transition: background-image 1s ease-in-out, filter 0.4s ease;
}

#shortcuts {
  position: absolute;
  inset: 0;
  z-index: 10;
}

.shortcut {
  width: var(--shortcut-size);
  padding: var(--padding-size);
  position: absolute;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
  border-radius: 6px;
  text-align: center;
  font-size: clamp(11px, 1.3vw, 13px);
  user-select: none;
  cursor: grab;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 8px rgba(255,255,255,0.15);
  transition: 
    transform 0.25s ease,
    background 0.4s ease,
    box-shadow 0.3s ease,
    opacity 0.2s ease;
  animation: fadeInScale 0.8s ease-out;
}

.shortcut:hover {
  transform: scale(1.08);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}

.shortcut.selected {
  outline: 2px solid #00ffff;
  background: rgba(0, 255, 255, 0.1);
  animation: pulse 1.2s infinite alternate ease-in-out;
}

.shortcut img {
  width: var(--icon-size);
  height: var(--icon-size);
  margin-bottom: 6px;
  image-rendering: pixelated;
  transition: transform 0.25s ease;
}

.shortcut:hover img {
  transform: scale(1.12) rotate(2deg);
}

.shortcut-label {
  margin-top: 2px;
  max-width: 100%;
  word-break: break-word;
  font-size: clamp(10px, 1vw, 12px);
  transition: opacity 0.3s ease;
}

.shortcut a {
  color: white;
  font-weight: bold;
  text-decoration: none;
  pointer-events: auto;
}

.shortcut-menu {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 18px;
  color: #ffffffaa;
  cursor: pointer;
  user-select: none;
  transition: transform 0.2s ease;
}

.shortcut-menu:hover {
  transform: rotate(10deg);
}

.shortcut-context {
  position: absolute;
  top: 28px;
  right: 6px;
  background: #111;
  border: 1px solid #444;
  font-size: 12px;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  z-index: 9999;
}

.shortcut-context.hidden {
  display: none;
}

.context-option {
  padding: 6px 12px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.context-option:hover {
  background: #222;
}

#morph-trigger, #trash {
  width: var(--icon-size);
  height: var(--icon-size);
  image-rendering: pixelated;
  border-radius: 6px;
  cursor: pointer;
  z-index: 20;
  transition: transform 0.3s ease, background 0.3s ease, filter 0.3s ease;
}

#morph-trigger {
  position: absolute;
  top: 2vh;
  right: 2vw;
  border: 2px dashed #00ffff;
  background: rgba(0, 0, 0, 0.3);
}

#morph-trigger:hover {
  transform: rotate(15deg) scale(1.1);
  background: rgba(0, 255, 255, 0.15);
  filter: drop-shadow(0 0 6px #00ffff);
}

#trash {
  position: absolute;
  bottom: calc(clamp(36px, 6vh, 42px) + 2vh + 12px);
  right: 2vw;
  padding: 6px;
  border: 2px dashed #ff4444;
  background: rgba(255, 0, 0, 0.1);
}

#trash:hover {
  background: rgba(255, 0, 0, 0.4);
  transform: scale(1.1);
  filter: drop-shadow(0 0 6px #ff4444);
}

#stats {
  position: absolute;
  bottom: calc(clamp(36px, 6vh, 42px) + 2vh + 12px);
  left: 2vw;
  padding: 1.2rem 1.6rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid #fff;
  border-radius: 6px;
  font-size: clamp(12px, 1vw, 14px);
  line-height: 1.6;
  box-shadow: 0 0 8px rgba(255,255,255,0.1);
  z-index: 20;
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

#stats:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 0 10px rgba(255,255,255,0.15);
}

#add-shortcut-btn {
  position: absolute;
  top: 2vh;
  left: 2vw;
  padding: 0.6rem 1.2rem;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
  border-radius: 6px;
  color: white;
  font-size: clamp(12px, 1.2vw, 14px);
  cursor: pointer;
  font-family: 'Pixel', monospace;
  box-shadow: 0 0 6px rgba(255,255,255,0.1);
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  z-index: 20;
}

#add-shortcut-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: scale(1.06);
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}

#taskbar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: clamp(36px, 6vh, 42px);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border-top: 2px solid #fff;
  font-family: 'Pixel', monospace;
  box-shadow: 0 -2px 6px rgba(255,255,255,0.1);
  backdrop-filter: blur(2px);
  z-index: 50;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

#taskbar:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 -2px 8px rgba(0,255,255,0.2);
}

#searchbar {
  position: fixed;
  top: 1vh;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid #fff;
  border-radius: 6px;
  color: white;
  font-family: 'Pixel', monospace;
  font-size: clamp(12px, 1.2vw, 14px);
  width: clamp(200px, 40vw, 400px);
  box-shadow: 0 0 6px rgba(255,255,255,0.1);
  transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  z-index: 50;
}

#searchbar:hover {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 10px rgba(0,255,255,0.2);
}

.fake-tab {
  position: absolute;
  top: 10vh;
  left: 10vw;
  width: 80vw;
  height: 80vh;
  display: flex;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #fff;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(255,255,255,0.1);
  overflow: hidden;
  font-family: 'Pixel', monospace;
  backdrop-filter: blur(2px);
  z-index: 999;
  animation: fadeInScale 0.6s ease-out;
}

.fake-tab iframe {
  flex: 1;
  border: none;
  background: white;
}

.fake-header {
  background: rgba(0, 0, 0, 0.4);
  color: white;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #555;
  font-size: clamp(11px, 1vw, 13px);
  cursor: move;
}

.fake-header button {
  padding: 2px 6px;
  margin-left: 6px;
  background: transparent;
  border: 1px solid #aaa;
  border-radius: 4px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  font-family: 'Pixel', monospace;
  transition: background 0.2s ease, transform 0.2s ease;
}

.fake-header button:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.1);
}

.pin-btn {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 4px;
  font-size: 14px;
  background: rgba(255,255,255,0.1);
  border: 1px solid #aaa;
  border-radius: 4px;
  color: white;
  cursor: pointer;
  font-family: 'Pixel', monospace;
  z-index: 20;
  transition: background 0.2s ease, transform 0.2s ease;
}

.pin-btn:hover {
  background: rgba(255,255,255,0.2);
  transform: rotate(-5deg);
}

.selection-box {
  position: fixed;
  border: 1px dashed #00ffff;
  background: rgba(0, 255, 255, 0.1);
  z-index: 9999;
  pointer-events: none;
}

@keyframes fadeInScale {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  from { box-shadow: 0 0 6px rgba(0,255,255,0.4); }
  to { box-shadow: 0 0 12px rgba(0,255,255,0.8); }
}

@media (max-width: 768px) {
  .shortcut {
    width: clamp(70px, 18vw, 90px);
  }
  #add-shortcut-btn,
  #stats {
    font-size: 12px;
    padding: 0.6rem;
  }
}