:root {
  --ink: #11182b;
  --muted: #556078;
  --quiet: #778098;
  --accent: #7b5cff;
  --accent-strong: #5f43ef;
  --blue: #2385ff;
  --line: rgba(65, 78, 116, 0.16);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --shadow: 0 22px 70px rgba(45, 55, 92, 0.22);
  --soft-shadow: 0 12px 34px rgba(28, 38, 72, 0.18);
  --font: "Segoe UI Variable Display", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  color: var(--ink);
  background: #dbe8fb;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

:where(button, input):focus-visible {
  outline: 2px solid rgba(123, 92, 255, 0.82);
  outline-offset: 4px;
  box-shadow: 0 0 0 6px rgba(123, 92, 255, 0.16);
}

.xos-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(17, 24, 43, 0.03), rgba(17, 24, 43, 0.1)),
    url("/assets/wallpapers/xos-dawn-lake.png") center / cover no-repeat;
}

.desktop {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.desktop,
.system-library,
.library-main,
.library-content,
.dock {
  max-width: 100vw;
}

.desktop::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.48), transparent 28%),
    linear-gradient(90deg, rgba(45, 63, 119, 0.03), rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.desktop-icons {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.desktop-item {
  position: absolute;
  width: 102px;
  min-height: 112px;
  padding: 0;
  border: 0;
  background: transparent;
  color: white;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45), 0 1px 1px rgba(0, 0, 0, 0.55);
}

.desktop-item img {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0 auto 7px;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(16, 31, 72, 0.32));
}

.desktop-item span {
  display: block;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0;
}

.desktop-item:hover img,
.desktop-item:focus-visible img {
  transform: translateY(-2px) scale(1.03);
}

.window {
  position: absolute;
  z-index: 10;
  overflow: hidden;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,255,255,0.72)),
    rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.24);
}

.system-library {
  left: clamp(118px, 10.8vw, 214px);
  right: clamp(16px, 6vw, 142px);
  top: clamp(14px, 3vh, 38px);
  bottom: clamp(104px, 12.4vh, 138px);
  display: grid;
  grid-template-columns: clamp(218px, 17vw, 284px) minmax(0, 1fr);
  border-radius: clamp(20px, 2vw, 30px);
}

.system-library.is-hidden {
  display: none;
}

.library-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: clamp(10px, 1.7vh, 22px);
  padding: clamp(18px, 2vw, 28px) clamp(16px, 1.7vw, 26px) clamp(16px, 1.6vw, 22px);
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.54), rgba(255,255,255,0.24));
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  width: clamp(46px, 4.4vw, 64px);
  height: clamp(46px, 4.4vw, 64px);
  place-items: center;
  color: white;
  font-weight: 900;
  font-size: clamp(28px, 2.8vw, 40px);
  line-height: 1;
  background: linear-gradient(135deg, #2bd5ff 0%, #6b5cff 52%, #ff66d4 100%);
  border-radius: 18px;
  box-shadow: 0 15px 28px rgba(91, 92, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.72);
  transform: skewX(-7deg);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  font-size: 24px;
}

.brand-lockup h1,
.brand-lockup p {
  margin: 0;
}

.brand-lockup h1 {
  font-size: clamp(20px, 1.8vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-lockup p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: clamp(38px, 4.6vh, 48px);
  padding: 7px 10px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  font-weight: 700;
  text-align: left;
}

.category-button img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.category-button.is-active {
  color: #6d32df;
  background: linear-gradient(135deg, rgba(255,255,255,0.82), rgba(255, 240, 250, 0.54));
  border-color: rgba(201, 151, 255, 0.5);
  box-shadow: 0 8px 26px rgba(117, 88, 214, 0.13);
}

.status-card {
  margin-top: auto;
  padding: clamp(12px, 1.2vw, 16px);
  background: rgba(255,255,255,0.58);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.status-row,
.status-card label,
.user-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-row {
  margin-bottom: 13px;
}

.status-row span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-row i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: #29ce7b;
}

.status-card label {
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-card b {
  color: var(--ink);
  font-weight: 700;
}

.meter {
  height: 5px;
  overflow: hidden;
  background: rgba(91, 91, 132, 0.13);
  border-radius: 99px;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7867ff, #b066ff);
  border-radius: inherit;
}

.user-card {
  gap: 10px;
  padding-top: 2px;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, #7a62ff, #b07cff);
  border-radius: 99px;
  font-weight: 800;
}

.user-card div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card strong {
  font-size: 13px;
}

.user-card span {
  color: var(--muted);
  font-size: 11px;
}

.icon-button,
.window-close {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.55);
  color: #35415c;
  border-radius: 99px;
}

.icon-button {
  width: 32px;
  height: 32px;
}

.library-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: clamp(18px, 2vw, 28px) clamp(18px, 2vw, 30px) clamp(16px, 1.6vw, 24px);
}

.library-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(220px, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.4vw, 20px);
  padding-bottom: clamp(12px, 1.6vh, 18px);
}

.library-header h2,
.library-header p {
  margin: 0;
}

.library-header h2 {
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 850;
  letter-spacing: -0.025em;
}

.library-header p {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

.search-box,
.dock-search {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: clamp(40px, 5.4vh, 50px);
  padding: 0 clamp(12px, 1.4vw, 18px);
  color: #536079;
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 8px 22px rgba(36, 48, 87, 0.08);
}

.search-box input,
.dock-search input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.view-button {
  min-height: clamp(34px, 4.3vh, 38px);
  padding: 0 clamp(12px, 1.2vw, 16px);
  color: #3c4865;
  background: rgba(255,255,255,0.48);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 750;
}

.view-button.is-active {
  color: #6d32df;
  background: rgba(255,255,255,0.88);
  box-shadow: 0 7px 16px rgba(48, 56, 96, 0.14);
}

.window-close {
  width: clamp(36px, 4.5vh, 42px);
  height: clamp(36px, 4.5vh, 42px);
  font-size: 24px;
}

.library-content {
  min-height: 0;
  overflow: auto;
  padding: 6px 4px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(110, 119, 156, 0.42) transparent;
}

.app-section {
  margin-bottom: clamp(14px, 2vh, 20px);
}

.app-section header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.app-section h3 {
  position: relative;
  margin: 0;
  padding-left: 13px;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.app-section h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(#bb66ff, #1aa6ff);
}

.app-section header button {
  color: #335cff;
  background: transparent;
  border: 0;
  font-weight: 700;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(78px, 8vw, 104px), 1fr));
  gap: clamp(10px, 1.35vw, 25px) clamp(12px, 2vw, 30px);
}

.app-icon {
  display: grid;
  justify-items: center;
  gap: 7px;
  min-width: 0;
  padding: 5px 2px 8px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 18px;
  text-align: center;
  font-size: clamp(11px, 0.9vw, 13px);
  font-weight: 750;
}

.app-icon img {
  width: clamp(52px, 5.9vw, 72px);
  height: clamp(52px, 5.9vw, 72px);
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(32, 43, 87, 0.18));
}

.app-icon:hover,
.app-icon:focus-visible {
  background: rgba(255,255,255,0.42);
}

.app-icon:hover img {
  transform: translateY(-2px) scale(1.04);
}

.library-content.is-list .app-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
}

.library-content.is-list .app-icon {
  grid-template-columns: 48px minmax(0, 1fr);
  justify-items: start;
  align-items: center;
  min-height: 62px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.38);
  text-align: left;
}

.library-content.is-list .app-icon img {
  width: 46px;
  height: 46px;
}

.empty-state {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.dock {
  position: fixed;
  left: max(clamp(4px, 1.25vw, 24px), env(safe-area-inset-left));
  right: max(clamp(4px, 1.25vw, 24px), env(safe-area-inset-right));
  bottom: max(clamp(4px, 2vh, 20px), env(safe-area-inset-bottom));
  z-index: 40;
  display: grid;
  grid-template-columns: auto minmax(160px, 340px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.1vw, 18px);
  min-height: clamp(68px, 8.8vh, 86px);
  padding: clamp(8px, 1.3vh, 12px) clamp(10px, 1.2vw, 18px);
  background: linear-gradient(135deg, rgba(255,255,255,0.7), rgba(246, 241, 255, 0.58));
  border: 1px solid rgba(255,255,255,0.76);
  border-radius: 24px;
  box-shadow: 0 18px 54px rgba(25, 35, 72, 0.22), inset 0 1px 0 rgba(255,255,255,0.9);
  backdrop-filter: blur(24px) saturate(1.28);
}

.dock-brand,
.dock-item {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: transparent;
  border: 0;
}

.dock-brand {
  grid-template-columns: auto auto;
  gap: 10px;
  padding: 0 10px;
  font-size: clamp(18px, 1.6vw, 23px);
  font-weight: 800;
}

.dock-apps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1vw, 18px);
  min-width: 0;
}

.dock-item {
  width: clamp(46px, 4.4vw, 58px);
  height: clamp(46px, 4.4vw, 58px);
  border-radius: clamp(14px, 1.35vw, 18px);
  background: rgba(255,255,255,0.3);
}

.dock-item img {
  width: clamp(40px, 3.8vw, 50px);
  height: clamp(40px, 3.8vw, 50px);
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(27, 37, 73, 0.18));
}

.dock-item span {
  display: none;
}

.dock-item.is-active {
  background: rgba(255,255,255,0.68);
  box-shadow: 0 10px 22px rgba(45, 53, 98, 0.16);
}

.dock-item.is-running::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: rgba(123, 92, 255, 0.78);
  transform: translateX(-50%);
  box-shadow: 0 0 0 4px rgba(123, 92, 255, 0.14);
}

.dock-item.is-active::after {
  width: 28px;
  height: 4px;
  background: linear-gradient(90deg, #2bd5ff, #7b5cff);
}

.system-tray {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1vw, 18px);
  min-height: clamp(46px, 6vh, 54px);
  padding: 0 clamp(10px, 1.2vw, 18px);
  color: #26324e;
  background: rgba(255,255,255,0.44);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-weight: 800;
  white-space: nowrap;
}

#clock {
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 900;
}

@media (max-width: 1240px) {
  .system-library {
    left: clamp(98px, 10vw, 134px);
    right: clamp(12px, 3vw, 34px);
    grid-template-columns: clamp(190px, 21vw, 236px) minmax(0, 1fr);
  }

  .library-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .view-controls {
    position: absolute;
    top: 24px;
    right: 24px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  }

  .dock {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .dock-search {
    display: none;
  }
}

@media (max-width: 980px) {
  .system-library {
    left: clamp(84px, 10vw, 104px);
    right: 10px;
    top: 12px;
    bottom: clamp(96px, 13vh, 120px);
    grid-template-columns: 168px minmax(0, 1fr);
  }

  .brand-lockup {
    gap: 10px;
  }

  .brand-lockup p,
  .library-header p,
  .status-card,
  .user-card {
    display: none;
  }

  .category-button {
    gap: 9px;
    font-size: 13px;
  }

  .category-button img {
    width: 24px;
    height: 24px;
  }

  .library-header {
    grid-template-columns: 1fr;
    padding-right: 132px;
  }

  .search-box {
    max-width: 100%;
  }

  .view-controls {
    top: 18px;
    right: 18px;
  }

  .dock {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .dock-search {
    display: none;
  }

  .system-tray span:not(:last-child) {
    display: none;
  }
}

@media (max-width: 860px) {
  .desktop-icons {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(12px, 2.2vh, 22px);
    width: 86px;
    padding: clamp(14px, 2vw, 22px) 0 0 clamp(10px, 2vw, 20px);
    pointer-events: none;
  }

  .desktop-item {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 74px;
    min-height: 88px;
    pointer-events: auto;
  }

  .desktop-item img {
    width: 58px;
    height: 58px;
    margin-bottom: 5px;
  }

  .desktop-item span {
    font-size: 11px;
  }

  .system-library {
    left: clamp(92px, 14vw, 118px);
    right: 8px;
    grid-template-columns: 1fr;
  }

  .library-sidebar {
    display: none;
  }
}

@media (max-width: 760px) {
  .system-library {
    left: 8px;
    right: 8px;
    top: 10px;
    bottom: clamp(104px, 18vh, 132px);
    grid-template-columns: 1fr;
  }

  .library-main {
    padding: 14px;
  }

  .library-header {
    padding-right: 0;
  }

  .view-controls {
    position: static;
    justify-content: flex-end;
  }

  .view-button {
    min-width: 0;
    padding-inline: 11px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  }

  .dock {
    left: 14px;
    right: 14px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    min-height: 92px;
    padding: 10px;
  }

  .dock-apps {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 10px;
  }

  .dock-item {
    width: 48px;
    height: 48px;
  }

  .dock-item img {
    width: 42px;
    height: 42px;
  }

  .system-tray {
    display: none;
  }
}

@media (max-width: 560px) {
  .desktop-icons {
    flex-direction: row;
    width: auto;
    max-width: calc(100vw - 20px);
    padding: 10px;
    overflow: hidden;
  }

  .desktop-item {
    width: 62px;
    min-height: 76px;
    flex: 0 0 62px;
  }

  .desktop-item img {
    width: 48px;
    height: 48px;
  }

  .desktop-item span {
    font-size: 10px;
  }

  .system-library {
    left: 8px;
    top: 96px;
    bottom: 116px;
  }

  .library-header h2 {
    font-size: 18px;
  }

  .search-box {
    min-height: 38px;
  }

  .app-grid {
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    gap: 8px;
  }

  .app-icon img {
    width: 44px;
    height: 44px;
  }

  .app-icon {
    font-size: 10px;
  }

  .dock {
    left: 6px;
    right: 6px;
    bottom: 6px;
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    min-height: 92px;
    border-radius: 22px;
  }

  .dock-brand,
  .system-tray {
    display: none;
  }

  .dock-apps {
    width: 100%;
  }
}

@media (max-height: 720px) {
  .system-library {
    top: 10px;
    bottom: clamp(84px, 14vh, 106px);
  }

  .library-sidebar {
    gap: 8px;
  }

  .category-button {
    min-height: 34px;
  }

  .app-section {
    margin-bottom: 12px;
  }

  .app-grid {
    gap: 8px 12px;
  }

  .dock {
    min-height: 66px;
    padding-block: 7px;
  }
}
