:root {
  --bg: #111111;
  --panel-bg: rgba(20, 20, 20, 0.7);
  --win-bg: rgba(20, 20, 20, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --ease: cubic-bezier(0.77, 0, 0.18, 1);
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: #111;
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  background: transparent;
  transition: background 1s var(--ease);
  text-transform: lowercase;
}

@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  * { cursor: none !important; }
}

#wallpaper {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  object-fit: cover;
  z-index: 0;
  filter: grayscale(1) brightness(0.45);
  transition: filter 1s var(--ease);
  pointer-events: none;
}

#snow-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 1;
  pointer-events: none;
}

.spark {
  position: fixed;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 9999;
  animation: sparkFly 0.5s ease-out forwards;
}

@keyframes sparkFly {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(0.2); }
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

#icons {
  position: absolute;
  top: 32px;
  left: 32px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  z-index: 2;
}

.icon {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  opacity: 0.92;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
  border-radius: 16px;
  padding: 8px 0 4px 0;
  background: rgba(30, 30, 30, 0.2);
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(2px);
  animation: iconIn 0.7s var(--ease);
}

.icon:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 6px 24px 0 rgba(0, 0, 0, 0.22);
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
}

.icon img {
  width: 48px;
  height: 48px;
  filter: grayscale(1) contrast(1.2);
  border-radius: 12px;
  margin-bottom: 4px;
  transition: filter 0.3s;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.06);
}

.icon span {
  font-size: 13px;
  color: #fff;
  text-shadow: 0 1px 2px #000;
  letter-spacing: 0.02em;
  font-weight: 700;
  text-align: center;
  margin-top: 2px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  width: 100%;
}

@keyframes iconIn {
  0%   { opacity: 0; transform: scale(0.7) translateY(30px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

#icon-template { display: none; }

.tasks {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: center;
  min-width: 0;
}

.task-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: scale(0.9);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  cursor: pointer;
}

.task-icon.visible { opacity: 1; transform: scale(1); }

.window {
  position: fixed;
  width: min(600px, calc(100vw - 16px));
  max-height: calc(100vh - 120px);
  background: var(--win-bg);
  border-radius: 14px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
  z-index: 18;
  border: 1.5px solid var(--border);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
  display: none;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.96) translateY(8px);
  transition: opacity .18s cubic-bezier(.22, .61, .36, 1), transform .18s cubic-bezier(.22, .61, .36, 1);
  will-change: transform, opacity;
}

#terminal-window {
  width: min(800px, calc(100vw - 16px));
}

.window.visible { opacity: 1; transform: scale(1) translateY(0); }

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
  user-select: none;
  cursor: move;
}

.window-header span {
  display: block;
  flex: 1;
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.8);
}

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

.window-body {
  padding: 16px;
  box-sizing: border-box;
}

.close-btn, .minimize-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 14px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  cursor: pointer;
}

.minimize-btn { padding-bottom: 3px; }
.close-btn:hover, .minimize-btn:hover { background: rgba(255, 255, 255, 0.08); }

#notepad-text {
  width: 100%;
  height: 380px;
  background: rgba(17, 17, 17, 0.35);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  outline: none;
  padding: 10px;
  font-family: monospace;
  font-size: 14px;
  resize: none;
  box-sizing: border-box;
}

.terminal-body { display: flex; flex-direction: column; height: 400px; }

#terminal-output {
  flex: 1;
  overflow-y: auto;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 14px;
  font-family: 'Courier New', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 13px;
  line-height: 1.6;
  color: #ccc;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

#terminal-output::-webkit-scrollbar { width: 6px; }
#terminal-output::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 3px; }
#terminal-output > div { margin-bottom: 4px; }
#terminal-output .prompt-line { color: #fff; }
#terminal-output .prompt-user { color: #fff; font-weight: 700; }
#terminal-output .prompt-path { color: #888; }
#terminal-output .error { color: #ff7b72; }
#terminal-output .success { color: #ccc; }
#terminal-output .hint { color: #888; }

#terminal-output .cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: #fff;
  animation: blink 1s step-end infinite;
  vertical-align: text-bottom;
  margin-left: 1px;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

#terminal-window { background: #000; }

#projects-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.project-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
  transition: background 0.2s, border-color 0.2s;
}

.project-card:hover { background: rgba(255, 255, 255, 0.08); }

.project-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
  user-select: none;
}

.project-card-header img {
  width: 64px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.project-card-name {
  flex: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.project-card-chevron {
  color: #888;
  font-size: 18px;
  line-height: 1;
  transition: transform 0.2s var(--ease);
}

.project-card.open .project-card-chevron { transform: rotate(45deg); }

.project-card-detail {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s var(--ease), opacity 0.25s var(--ease);
}

.project-card.open .project-card-detail {
  max-height: 240px;
  opacity: 1;
}

.project-card-detail-pad {
  padding: 0 12px 12px;
}

.project-card-desc {
  font-size: 13px;
  color: #aaa;
  line-height: 1.5;
  margin: 0 0 12px;
}

.project-btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  color: #000;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 0.2s;
}

.project-btn:hover { background: #e6e6e6; }

.project-btn-soon {
  background: rgba(255, 255, 255, 0.1);
  color: #888;
  cursor: default;
}

.project-btn-soon:hover { background: rgba(255, 255, 255, 0.1); }

.mp3-window { width: 300px; background: #000; }

.mp3-body {
  padding: 18px 16px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.mp3-cover-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 6px 24px 0 rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  background: #000;
}

.cd {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  overflow: hidden;
}

.cd::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.04) 35%, transparent 55%);
  pointer-events: none;
}

.cd.spinning { animation: cdSpin 9s linear infinite; }

@keyframes cdSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.mp3-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(0.95) brightness(0.85);
}

.cd-grooves {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 50% 50%,
    rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px,
    transparent 1px, transparent 5px);
  pointer-events: none;
}

.cd-hole {
  position: absolute;
  top: 50%; left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.04);
  z-index: 2;
}

.mp3-meta {
  width: 100%;
  text-align: center;
  line-height: 1.35;
}

.mp3-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp3-artist {
  font-size: 12px;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp3-seek {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
  cursor: pointer;
  overflow: hidden;
}

.mp3-seek-fill {
  height: 100%;
  width: 0%;
  background: #fff;
  border-radius: 2px;
}

.mp3-times {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #666;
  letter-spacing: 0.02em;
  margin-top: -6px;
}

.mp3-times-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mp3-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.mp3-btn {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.mp3-btn:hover { background: rgba(255, 255, 255, 0.08); }

.mp3-btn-main {
  width: 44px;
  height: 44px;
  background: #fff;
  color: #000;
}

.mp3-btn-main:hover { background: #e6e6e6; }

.mp3-mute {
  padding: 2px;
  color: #666;
}

.mp3-mute:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }

#about-window { width: 280px; }

.about-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.about-pic {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.2);
  border: 2px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 10px;
}

.about-name {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.6), 0 0 16px rgba(255, 255, 255, 0.3);
}

.about-tag {
  font-size: 11px;
  color: #555;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.about-rows {
  width: 100%;
  text-align: left;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.about-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #777;
  margin-bottom: 6px;
}

.about-row svg {
  width: 14px;
  height: 14px;
  color: #444;
  flex-shrink: 0;
}

#profile-popup {
  position: fixed;
  display: none;
  flex-direction: column;
  align-items: center;
  min-width: 260px;
  background: rgba(20, 20, 20, 0.30);
  border-radius: 18px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
  padding: 32px 28px 24px 28px;
  z-index: 100;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: scale(0.96) translate3d(0, 8px, 0);
  transition: opacity .18s cubic-bezier(.22, .61, .36, 1), transform .18s cubic-bezier(.22, .61, .36, 1);
  -webkit-backdrop-filter: blur(12px) saturate(120%);
  backdrop-filter: blur(12px) saturate(120%);
  will-change: transform, opacity;
  backface-visibility: hidden;
  contain: layout paint;
  bottom: 72px;
  left: 80px;
  right: auto;
}

#profile-popup.popup-visible { opacity: 1; transform: scale(1) translate3d(0, 0, 0); }

#profile-popup .pfp {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin-bottom: 12px;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.18);
  background: #222;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter 0.3s;
}

#profile-popup .name {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px #000;
}

#profile-popup .status {
  font-size: 14px;
  color: #bbb;
  margin-bottom: 10px;
  text-align: left;
  min-height: 18px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px #000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

#profile-popup .custom-text {
  font-size: 15px;
  color: #fff;
  margin-bottom: 4px;
  text-align: center;
  letter-spacing: 0.01em;
  min-height: 18px;
  opacity: 0.8;
}

#context-menu {
  position: fixed;
  display: none;
  flex-direction: column;
  min-width: 160px;
  background: rgba(20, 20, 20, 0.9);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
  z-index: 9998;
  padding: 6px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

#context-menu.visible { display: flex; }

#context-menu a {
  color: #ddd;
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 8px 10px;
  border-radius: 6px;
}

#context-menu a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

#panel {
  position: fixed;
  left: 8px; right: 8px; bottom: 8px;
  height: 44px;
  background: var(--panel-bg);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 -2px 16px 0 rgba(0, 0, 0, 0.18);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  z-index: 20;
  padding: 0 24px;
  animation: panelIn 1.1s var(--ease);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  backdrop-filter: blur(8px) saturate(120%);
}

@keyframes panelIn {
  0%   { opacity: 0; transform: translateY(48px); }
  100% { opacity: 1; transform: translateY(0); }
}

#panel .left {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  min-width: 0;
}

#panel .right {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-self: end;
  min-width: 0;
}

#profile-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#profile-pic {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #222;
  filter: grayscale(1);
  transition: filter 0.3s;
  cursor: pointer;
  box-shadow: 0 1px 6px 0 rgba(0, 0, 0, 0.12);
}

#profile-pic:hover { filter: grayscale(1) brightness(1); }

#profile-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 4px #000;
  margin-right: 8px;
}

#typing-status {
  font-size: 10px;
  color: #888;
  letter-spacing: 0.03em;
  font-weight: 600;
  text-shadow: 0 1px 4px #000;
  min-height: 14px;
}

.clock {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px #000;
  min-width: 80px;
  text-align: right;
}

#custom-cursor {
  position: fixed;
  top: 0; left: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 100001;
  transform: translate(-50%, -50%);
  display: none;
}

#custom-cursor img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

#enter-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.6s ease;
}

#enter-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.enter-hint {
  font-size: 15px;
  letter-spacing: 0.14em;
  color: #999;
  user-select: none;
  animation: enterBlink 1.8s ease-in-out infinite;
}

@keyframes enterBlink {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 0.35; }
}

.tray-player {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tray-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #fff;
  cursor: pointer;
  width: 20px;
  height: 20px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.tray-btn:hover { background: rgba(255, 255, 255, 0.18); }

.tray-title {
  font-size: 11px;
  color: #bbb;
  letter-spacing: 0.02em;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 4px #000;
  cursor: default;
}

@media (max-width: 700px) {
  #icons { left: 8px; top: 8px; gap: 20px; }
  .icon { width: 56px; padding: 6px 0 3px 0; }
  .icon img { width: 36px; height: 36px; border-radius: 10px; }
  .icon span { font-size: 11px; }
  #panel { padding: 0 10px; height: 40px; border-radius: 10px; }
  #tasks { max-width: 45vw; overflow-x: auto; }
  .task-icon { padding: 4px 6px; gap: 4px; font-size: 12px; }
  .task-icon img { width: 14px !important; height: 14px !important; }
  #profile-popup { left: 8px; right: 8px; min-width: unset; bottom: 56px; padding: 24px 20px 18px 20px; }
  .window { width: calc(100vw - 16px) !important; max-height: calc(100vh - 72px); }
  #terminal-window { width: calc(100vw - 16px) !important; }
  .terminal-body { height: calc(100vh - 120px); }
  #notepad-text { height: calc(100vh - 140px); }
  #about-window { width: calc(100vw - 16px) !important; max-width: 280px; left: calc(50% - 140px) !important; }
  .mp3-window { width: 260px !important; left: calc(50% - 130px) !important; }
  .tray-title { max-width: 80px; }
  .clock { font-size: 14px; min-width: 70px; }
  #profile-name { font-size: 14px; margin-right: 4px; }
  #profile-pic { width: 28px; height: 28px; }
}

@media (max-width: 400px) {
  #icons { left: 4px; top: 4px; gap: 14px; }
  .icon { width: 48px; padding: 4px 0 2px 0; }
  .icon img { width: 32px; height: 32px; border-radius: 8px; }
  .icon span { font-size: 10px; }
  #profile-name { display: none; }
  #profile-pic { width: 24px; height: 24px; }
  .clock { font-size: 12px; min-width: 60px; }
  .tray-title { display: none; }
  #panel { padding: 0 6px; height: 36px; }
  #tasks { max-width: 55vw; }
}

@media (min-width: 701px) and (max-width: 1024px) {
  .window { max-height: calc(100vh - 100px); }
  .terminal-body { height: 50vh; max-height: 400px; }
  #notepad-text { height: 45vh; max-height: 380px; }
}
