:root {
  --dock-size: clamp(44px, 5.2vw, 66px);
  --dock-gap: clamp(8px, 1.15vw, 14px);
  --dock-lift: 24px;
  --glass-bg: rgba(246, 248, 255, 0.22);
  --glass-border: rgba(255, 255, 255, 0.42);
}


* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  font-family: "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.45), transparent 42%),
    radial-gradient(circle at 78% 92%, rgba(147, 241, 255, 0.3), transparent 36%),
    url("assets/wallpapers/tahoe-light-6k.png") center top/cover no-repeat;
}

.desktop {
  position: relative;
  width: 100vw;
  height: 100vh;
}

.noise-flash {
  position: fixed;
  inset: 0;
  z-index: 1400;
  pointer-events: none;
  --slice-top: 38%;
  --slice-bottom: 56%;
  --warp-x: 0px;
  --warp-y: 0px;
  --flash: 0.6;
  opacity: 0;
  background:
    linear-gradient(
      180deg,
      transparent 0%,
      transparent var(--slice-top),
      rgba(255, 255, 255, 0.9) var(--slice-top),
      rgba(255, 255, 255, 0.9) var(--slice-bottom),
      transparent var(--slice-bottom),
      transparent 100%
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.92) 0px,
      rgba(255, 255, 255, 0.92) 2px,
      rgba(0, 0, 0, 0.95) 2px,
      rgba(0, 0, 0, 0.95) 4px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.12) 0px,
      rgba(255, 255, 255, 0.12) 1px,
      transparent 1px,
      transparent 3px
    );
  transform: translate(var(--warp-x), var(--warp-y));
  mix-blend-mode: screen;
  transition: opacity 40ms steps(2, end), transform 40ms steps(1, end);
}

.impact-flash {
  position: fixed;
  inset: 0;
  z-index: 1390;
  pointer-events: none;
  background: #ffffff;
  opacity: 0;
  animation: impactFlash 140ms ease;
}

@keyframes impactFlash {
  0% {
    opacity: 0;
  }
  35% {
    opacity: 0.92;
  }
  100% {
    opacity: 0;
  }
}

body.is-breaking .desktop {
  transform: translate(var(--desktop-x, 0px), var(--desktop-y, 0px)) skewX(var(--desktop-skew, 0deg));
  filter:
    hue-rotate(var(--desktop-hue, 0deg))
    saturate(var(--desktop-sat, 1))
    contrast(var(--desktop-contrast, 1));
  transition: transform 40ms steps(1, end), filter 40ms steps(1, end);
}

.desktop-files {
  position: absolute;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.desktop-file {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 92px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  text-align: center;
  text-shadow: 0 2px 5px rgba(8, 16, 30, 0.65);
  cursor: grab;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  transform: scale(1);
  transform-origin: center;
  transition: transform 110ms ease;
  will-change: transform;
}

.desktop-file.is-dragging {
  cursor: grabbing;
  transform: scale(0.94);
}

.desktop-file:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 3px;
  border-radius: 8px;
}

.file-icon {
  display: block;
  position: relative;
  width: 44px;
  height: 54px;
  margin: 0 auto 6px;
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(214, 224, 240, 0.95));
  box-shadow: 0 6px 12px rgba(8, 16, 30, 0.35);
}

.file-icon::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 13px;
  height: 13px;
  border-radius: 0;
  background: linear-gradient(135deg, rgba(194, 206, 229, 0.95), rgba(239, 245, 255, 0.95));
  border-left: 1px solid rgba(255, 255, 255, 0.55);
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
}

.file-name {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
  word-break: break-word;
}

.window-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.blank-window {
  position: absolute;
  width: min(520px, calc(100vw - 24px));
  height: min(350px, calc(100vh - 130px));
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: rgba(244, 248, 255, 0.84);
  box-shadow: 0 22px 45px rgba(7, 13, 26, 0.44);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  overflow: hidden;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: transform 180ms ease, opacity 180ms ease;
}

.blank-window.is-opening {
  transform: translateY(10px) scale(0.9);
  opacity: 0;
}

.blank-window-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-bottom: 1px solid rgba(209, 220, 241, 0.85);
  cursor: grab;
  user-select: none;
}

.blank-window-bar:active {
  cursor: grabbing;
}

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

.window-dot {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  padding: 0;
}

.window-dot.close {
  background: #ff5f57;
  cursor: pointer;
}

.window-dot.min {
  background: #febc2e;
}

.window-dot.zoom {
  background: #28c840;
}

.blank-window-title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: rgba(27, 39, 62, 0.78);
}

.blank-window-body {
  width: 100%;
  height: calc(100% - 36px);
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(238, 244, 255, 0.78));
}

.blank-window-body.is-barrier {
  overflow: hidden;
  background: #050507;
}

.barrier-screen {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 26px 18px;
  background: #050505;
  color: rgba(245, 245, 245, 0.86);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  overflow: hidden;
}

.barrier-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.05) 0px,
      rgba(255, 255, 255, 0.05) 1px,
      transparent 1px,
      transparent 6px
    ),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.04) 0px,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 8px
    );
  opacity: 0.3;
  mix-blend-mode: screen;
  pointer-events: none;
}

.barrier-screen::after {
  content: "";
  position: absolute;
  inset: -40% 0 0 0;
  background: linear-gradient(120deg, transparent 38%, rgba(255, 255, 255, 0.18), transparent 62%);
  opacity: 0.45;
  animation: barrierSweep 2.6s linear infinite;
  pointer-events: none;
}

@keyframes barrierSweep {
  0% {
    transform: translateX(-35%);
  }
  100% {
    transform: translateX(35%);
  }
}

.barrier-hud {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.barrier-orbit {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow:
    0 0 12px rgba(255, 255, 255, 0.24),
    inset 0 0 10px rgba(255, 255, 255, 0.18);
  position: relative;
  animation: barrierOrbit calc(var(--barrier-duration, 1600ms) * 1.1) linear infinite;
}

.barrier-orbit::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.9);
}

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

.barrier-readout {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.32em;
}

.barrier-label {
  color: rgba(255, 255, 255, 0.8);
}

.barrier-state {
  color: rgba(255, 255, 255, 0.9);
}

.barrier-progress {
  position: relative;
  z-index: 1;
  width: min(240px, 72%);
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.7);
  box-shadow:
    inset 0 0 14px rgba(255, 255, 255, 0.12),
    0 0 12px rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.barrier-progress::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.12) 0px,
    rgba(255, 255, 255, 0.12) 3px,
    transparent 3px,
    transparent 10px
  );
  opacity: 0.35;
}

.barrier-progress-bar {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transform: scaleX(0.08);
  background: linear-gradient(90deg, #ffffff, #e6e6e6 55%, #ffffff);
  box-shadow:
    0 0 10px rgba(255, 255, 255, 0.7),
    0 0 18px rgba(255, 255, 255, 0.35);
  animation: barrierFill var(--barrier-duration, 1600ms) ease-out forwards;
}

.barrier-progress-bar::after {
  content: "";
  position: absolute;
  top: -8px;
  left: -30%;
  width: 32%;
  height: 24px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0) 65%);
  filter: blur(1px);
  animation: barrierShine 900ms ease-in-out infinite;
}

@keyframes barrierFill {
  0% {
    transform: scaleX(0.08);
  }
  100% {
    transform: scaleX(1);
  }
}

@keyframes barrierShine {
  0% {
    transform: translateX(-40%);
    opacity: 0.2;
  }
  50% {
    opacity: 0.9;
  }
  100% {
    transform: translateX(220%);
    opacity: 0.2;
  }
}

.barrier-text {
  margin: 0;
  position: relative;
  z-index: 1;
  letter-spacing: 0.34em;
  color: rgba(255, 255, 255, 0.65);
}

.doc-content {
  padding: 16px 18px 18px;
  color: #1a2540;
  font-size: 13px;
  line-height: 1.45;
}

.doc-content h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.doc-content p {
  margin: 0 0 10px;
}

.doc-content ul {
  margin: 0;
  padding-left: 16px;
}

.doc-content li {
  margin-bottom: 8px;
}

.world-link {
  display: inline-block;
  margin-top: 4px;
  padding: 7px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: linear-gradient(135deg, #3d64c7, #273f88);
}

.dock-shell {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  width: min(98vw, max-content);
  max-width: 100%;
  padding: 7px 11px 9px;
  border-radius: 22px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 20px 35px rgba(8, 16, 30, 0.35);
}

.dock {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--dock-gap);
}

.dock-item {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: var(--dock-size);
  height: calc(var(--dock-size) + 18px);
  padding-bottom: 7px;
  transform-origin: center bottom;
  transform: translateY(calc(var(--y, 0) * -1px)) scale(var(--scale, 1));
  transition: transform 0.22s cubic-bezier(0.2, 0.6, 0.2, 1);
  will-change: transform;
}

.dock-item:hover,
.dock-item:focus-within {
  z-index: 2;
}

.dock-item.running::after {
  content: "";
  position: absolute;
  bottom: 1px;
  left: 50%;
  width: 4px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
}

.dock-item.dock-divider {
  width: 1px;
  height: calc(var(--dock-size) - 4px);
  margin: 0 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.4);
  transform: none;
}

.dock-item.dock-divider::after {
  display: none;
}

.dock-icon {
  width: var(--dock-size);
  height: var(--dock-size);
  display: block;
  border: 0;
  padding: 0;
  border-radius: 16px;
  background: transparent;
  cursor: default;
  appearance: none;
  -webkit-appearance: none;
  overflow: hidden;
  line-height: 0;
}

.dock-icon img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  user-select: none;
  pointer-events: none;
  box-shadow: 0 10px 18px rgba(4, 11, 25, var(--shadow, 0.4));
  transform: translateZ(0) scale(1.06);
  transform-origin: center;
  transition: box-shadow 0.22s ease;
}

.dock-label {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(18, 25, 44, 0.72);
  opacity: 0;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.dock-label::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(18, 25, 44, 0.72);
}

.dock-item:hover .dock-label {
  opacity: 1;
}

@media (max-width: 900px) {
  :root {
    --dock-size: clamp(42px, 7.8vw, 60px);
  }

  .dock-shell {
    width: calc(100vw - 12px);
    padding-inline: 6px;
    overflow-x: auto;
    overflow-y: visible;
    scrollbar-width: none;
  }

  .dock-shell::-webkit-scrollbar {
    display: none;
  }

  .dock {
    width: max-content;
    margin-inline: auto;
  }

  .desktop-file {
    width: 84px;
  }

  .blank-window {
    height: min(310px, calc(100vh - 122px));
  }
}
