:root {
  color-scheme: dark;
  --page: #050505;
  --text: #f5f5f7;
  --muted: rgba(245, 245, 247, 0.68);
  --online: #30d158;
  --offline: #ff453a;
  --unknown: #8e8e93;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 34%),
    var(--page);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.shell {
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(22px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(22px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}

.app-grid {
  width: min(780px, 100%);
  display: grid;
  gap: clamp(14px, 2.2vh, 22px);
}

.app-row {
  width: 100%;
}

.app-row-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 132px;
  justify-content: center;
  gap: clamp(16px, 3vw, 34px);
  align-items: start;
}

.app-tile {
  width: 132px;
  min-height: 154px;
  display: grid;
  grid-template-rows: 104px 19px 25px;
  justify-items: center;
  align-items: start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app-tile:focus-visible .icon-shell {
  outline: 2px solid rgba(255, 255, 255, 0.84);
  outline-offset: 5px;
}

.app-tile:active .icon-shell {
  transform: scale(0.96);
}

.app-tile.dragging {
  position: fixed;
  z-index: 20;
  opacity: 0.96;
  pointer-events: none;
  filter: drop-shadow(0 22px 34px rgba(0, 0, 0, 0.56));
}

.app-placeholder {
  display: block;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.06);
}

.icon-shell {
  position: relative;
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 27px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 34%),
    linear-gradient(145deg, var(--accent-a), var(--accent-b));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    inset 0 -18px 28px rgba(0, 0, 0, 0.16),
    0 14px 26px rgba(0, 0, 0, 0.34);
  transition: transform 150ms ease, filter 150ms ease;
}

.status-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(5, 5, 5, 0.86);
  background: var(--unknown);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.status-dot.online {
  background: var(--online);
}

.status-dot.offline {
  background: var(--offline);
}

.app-name {
  width: 100%;
  color: rgba(245, 245, 247, 0.9);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.72);
}

.app-description {
  width: 100%;
  color: rgba(245, 245, 247, 0.52);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.72);
}

.glyph {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.94);
}

.glyph::before,
.glyph::after,
.glyph-core,
.glyph-core::before,
.glyph-core::after {
  content: "";
  position: absolute;
}

.glyph-jellyfin::before {
  inset: 8px;
  border-radius: 18px;
  border: 12px solid currentColor;
  transform: rotate(45deg);
}

.glyph-jellyfin::after {
  inset: 24px;
  border-radius: 7px;
  background: currentColor;
  transform: rotate(45deg);
}

.glyph-yt::before {
  inset: 13px 5px;
  border-radius: 12px;
  background: currentColor;
}

.glyph-yt::after {
  top: 22px;
  left: 27px;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 17px solid #d9001b;
}

.glyph-photo::before {
  left: 6px;
  top: 10px;
  width: 52px;
  height: 42px;
  border-radius: 11px;
  background: currentColor;
}

.glyph-photo::after {
  left: 36px;
  top: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffcc00;
}

.glyph-photo .glyph-core {
  left: 14px;
  top: 34px;
  width: 38px;
  height: 18px;
  overflow: hidden;
  border-radius: 0 0 8px 8px;
}

.glyph-photo .glyph-core::before {
  left: -2px;
  top: 5px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #30d158;
  transform: rotate(45deg);
}

.glyph-photo .glyph-core::after {
  left: 16px;
  top: 1px;
  width: 31px;
  height: 31px;
  border-radius: 7px;
  background: #0a84ff;
  transform: rotate(45deg);
}

.glyph-torrent::before {
  left: 12px;
  top: 9px;
  width: 40px;
  height: 45px;
  border: 8px solid currentColor;
  border-top: 0;
  border-radius: 0 0 24px 24px;
}

.glyph-torrent::after {
  top: 7px;
  left: 9px;
  width: 13px;
  height: 24px;
  border-radius: 5px 5px 2px 2px;
  background: currentColor;
  box-shadow: 33px 0 0 currentColor;
}

.glyph-torrent .glyph-core {
  left: 28px;
  top: 30px;
  width: 8px;
  height: 22px;
  border-radius: 6px;
  background: currentColor;
}

.glyph-torrent .glyph-core::before {
  left: -14px;
  top: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(20, 116, 47, 0.68);
  box-shadow: 28px 0 0 rgba(20, 116, 47, 0.68);
}

.glyph-upload::before {
  left: 5px;
  top: 24px;
  width: 54px;
  height: 30px;
  border-radius: 10px;
  background: currentColor;
}

.glyph-upload::after {
  left: 9px;
  top: 16px;
  width: 22px;
  height: 13px;
  border-radius: 8px 8px 0 0;
  background: currentColor;
}

.glyph-upload .glyph-core {
  left: 28px;
  top: 12px;
  width: 8px;
  height: 32px;
  border-radius: 5px;
  background: #1f7ee8;
}

.glyph-upload .glyph-core::before {
  left: -10px;
  top: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-bottom: 16px solid #1f7ee8;
}

.glyph-upload .glyph-core::after {
  left: -14px;
  top: 38px;
  width: 36px;
  height: 5px;
  border-radius: 6px;
  background: #1f7ee8;
}

.glyph-drop::before {
  left: 8px;
  top: 20px;
  width: 19px;
  height: 31px;
  border: 5px solid currentColor;
  border-radius: 8px;
}

.glyph-drop::after {
  right: 8px;
  top: 12px;
  width: 25px;
  height: 39px;
  border: 5px solid currentColor;
  border-radius: 9px;
}

.glyph-drop .glyph-core {
  left: 22px;
  top: 8px;
  width: 20px;
  height: 20px;
  border-top: 5px solid currentColor;
  border-radius: 50%;
}

.glyph-audio::before {
  left: 12px;
  top: 6px;
  width: 40px;
  height: 36px;
  border: 8px solid currentColor;
  border-bottom: 0;
  border-radius: 30px 30px 0 0;
}

.glyph-audio::after {
  top: 34px;
  left: 8px;
  width: 13px;
  height: 20px;
  border-radius: 7px;
  background: currentColor;
  box-shadow: 35px 0 0 currentColor;
}

.glyph-audio .glyph-core {
  left: 22px;
  top: 39px;
  width: 20px;
  height: 15px;
  border-radius: 4px 4px 2px 2px;
  border: 4px solid currentColor;
  border-top: 0;
}

.glyph-audio .glyph-core::before {
  left: 7px;
  top: -3px;
  width: 4px;
  height: 17px;
  border-radius: 4px;
  background: currentColor;
}

.glyph-book::before,
.glyph-book::after {
  top: 10px;
  width: 25px;
  height: 43px;
  border-radius: 8px 3px 4px 8px;
  background: currentColor;
}

.glyph-book::before {
  left: 7px;
  transform: skewY(5deg);
}

.glyph-book::after {
  right: 7px;
  transform: skewY(-5deg);
}

.glyph-book .glyph-core {
  left: 30px;
  top: 13px;
  width: 4px;
  height: 39px;
  border-radius: 4px;
  background: rgba(30, 126, 106, 0.76);
}

.glyph-book .glyph-core::before {
  left: -15px;
  top: 12px;
  width: 11px;
  height: 3px;
  border-radius: 4px;
  background: rgba(30, 126, 106, 0.76);
  box-shadow: 33px 0 0 rgba(30, 126, 106, 0.76), 0 10px 0 rgba(30, 126, 106, 0.76), 33px 10px 0 rgba(30, 126, 106, 0.76);
}

.glyph-emu::before {
  left: 3px;
  top: 19px;
  width: 56px;
  height: 33px;
  border-radius: 22px 22px 18px 18px;
  background: currentColor;
}

.glyph-emu::after {
  left: 16px;
  top: 30px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b94a5a;
  box-shadow:
    -8px 0 0 #b94a5a,
    8px 0 0 #b94a5a,
    0 -8px 0 #b94a5a,
    30px -3px 0 1px #b94a5a,
    41px 7px 0 1px #b94a5a;
}

.glyph-emu .glyph-core {
  left: 20px;
  top: 11px;
  width: 24px;
  height: 15px;
  border: 5px solid currentColor;
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
}

.glyph-emu .glyph-core::before {
  left: 4px;
  top: 24px;
  width: 16px;
  height: 5px;
  border-radius: 5px;
  background: rgba(185, 74, 90, 0.72);
}

.glyph-roms::before,
.glyph-roms::after {
  left: 13px;
  width: 38px;
}

.glyph-roms::before {
  top: 7px;
  height: 50px;
  border-radius: 8px 8px 12px 12px;
  background: currentColor;
}

.glyph-roms::after {
  top: 14px;
  height: 17px;
  border-radius: 4px;
  background: #5162d9;
}

.glyph-roms .glyph-core {
  left: 20px;
  bottom: 10px;
  width: 24px;
  height: 7px;
  border-radius: 2px;
  background: #2ec4b6;
  box-shadow: 0 10px 0 #2ec4b6;
}

.glyph-roms .glyph-core::before {
  left: 4px;
  top: -22px;
  width: 16px;
  height: 4px;
  border-radius: 4px;
  background: #2ec4b6;
  box-shadow: 0 8px 0 #2ec4b6;
}

.glyph-private::before {
  left: 13px;
  top: 28px;
  width: 38px;
  height: 27px;
  border-radius: 8px;
  background: currentColor;
}

.glyph-private::after {
  left: 20px;
  top: 9px;
  width: 24px;
  height: 28px;
  border: 8px solid currentColor;
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
}

.glyph-private .glyph-core {
  left: 29px;
  top: 38px;
  width: 7px;
  height: 12px;
  border-radius: 6px;
  background: #303034;
}

.glyph-cv::before {
  inset: 5px 12px;
  border-radius: 8px;
  background: currentColor;
}

.glyph-cv::after {
  left: 23px;
  top: 13px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d69214;
}

.glyph-cv .glyph-core {
  left: 20px;
  top: 38px;
  width: 24px;
  height: 4px;
  border-radius: 5px;
  background: #d69214;
  box-shadow: 0 9px 0 #d69214;
}

.glyph-nova::before {
  content: "N";
  left: 13px;
  top: 1px;
  font-size: 43px;
  font-weight: 800;
  line-height: 1;
  color: currentColor;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.74);
}

.glyph-nova::after {
  top: 9px;
  right: 5px;
  width: 15px;
  height: 15px;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.72));
}

.glyph-nova .glyph-core {
  right: 14px;
  bottom: 9px;
  width: 10px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(50% 0, 62% 36%, 100% 50%, 62% 64%, 50% 100%, 38% 64%, 0 50%, 38% 36%);
}

.load-error {
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .app-grid {
    width: 100%;
    gap: 13px;
  }

  .app-row-grid {
    grid-auto-columns: 80px;
    gap: 7px;
  }

  .app-tile {
    width: 80px;
    min-height: 114px;
    grid-template-rows: 74px 16px 21px;
    gap: 3px;
  }

  .icon-shell {
    width: 74px;
    height: 74px;
    border-radius: 20px;
  }

  .status-dot {
    top: 6px;
    right: 6px;
    width: 12px;
    height: 12px;
  }

  .glyph {
    transform: scale(0.76);
  }

  .app-name {
    font-size: 12px;
  }

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

@media (max-height: 620px) {
  .shell {
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .app-grid {
    gap: 10px;
  }

  .app-row-grid {
    grid-auto-columns: 78px;
    gap: 7px;
  }

  .app-tile {
    width: 78px;
    min-height: 96px;
    grid-template-rows: 62px 14px 18px;
    gap: 2px;
  }

  .icon-shell {
    width: 62px;
    height: 62px;
    border-radius: 17px;
  }

  .glyph {
    transform: scale(0.64);
  }

  .app-name {
    font-size: 11px;
  }

  .app-description {
    font-size: 9px;
  }
}
