:root {
  --bg: #000000;
  --panel: #000000;
  --panel-soft: #0f0f10;
  --line: #262626;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --sidebar-width: 244px;
  --sidebar-collapsed: 78px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Instrument Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar-overlay {
  display: none;
}

.mobile-menu-button {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: var(--sidebar-width);
  height: 100vh;
  padding: 1rem 0.75rem 1.5rem;
  border-right: 1px solid var(--line);
  background: var(--panel);
  transition: width 220ms ease, padding 220ms ease;
}

.sidebar.is-collapsed {
  width: var(--sidebar-collapsed);
  padding-inline: 0.55rem;
  border-right-color: transparent;
  background: transparent;
  box-shadow: none;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.5rem;
}

.icon-button,
.apply-button,
.mobile-menu-button {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
}

.mobile-menu-button {
  position: fixed;
  left: 0.8rem;
  top: 0.8rem;
  z-index: 25;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 999px;
  background: rgba(15, 15, 16, 0.92);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  color: var(--text);
}

.mobile-menu-button span {
  position: absolute;
  width: 1rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.mobile-menu-button span:first-child {
  transform: translateY(-4px);
}

.mobile-menu-button span:last-child {
  transform: translateY(4px);
}

.sidebar-toggle {
  position: relative;
}

.sidebar-toggle span {
  position: absolute;
  width: 0.95rem;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 220ms ease;
}

.sidebar-toggle span:first-child {
  transform: translateY(-4px);
}

.sidebar-toggle span:last-child {
  transform: translateY(4px);
}

.sidebar.is-collapsed .sidebar-toggle span:first-child {
  transform: rotate(45deg);
}

.sidebar.is-collapsed .sidebar-toggle span:last-child {
  transform: rotate(-45deg);
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  height: 2.5rem;
  flex: 1;
  overflow: hidden;
}

.brand-image,
.nav-label {
  transition: opacity 180ms ease, transform 180ms ease;
}

.brand-image {
  position: absolute;
  left: 0;
  top: 50%;
  display: block;
  height: auto;
  transform: translateY(-50%);
}

.brand-image-full {
  width: 170px;
  opacity: 1;
}

.brand-image-icon {
  width: 34px;
  opacity: 0;
  pointer-events: none;
}

.sidebar-nav {
  display: grid;
  gap: 0.2rem;
}

.sidebar-account-row {
  margin-top: auto;
  padding: 0.35rem 0.85rem 0;
}

.sidebar-auth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  width: 100%;
  min-height: 44px;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
}

.sidebar-auth-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
}

.sidebar-auth-image {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  object-fit: contain;
}

.sidebar-auth-label {
  white-space: nowrap;
}

.sidebar.is-collapsed .sidebar-account-row {
  padding-inline: 0.15rem;
}

.sidebar.is-collapsed .sidebar-auth-button {
  width: 100%;
  min-width: 0;
  padding-inline: 0;
}

.sidebar.is-collapsed .sidebar-auth-label {
  display: none;
}

.sidebar.is-collapsed .sidebar-nav,
.sidebar.is-collapsed .sidebar-account-row {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
}

.nav-link:hover,
.nav-link.is-active {
  background: transparent;
}

.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
}

.nav-icon-image {
  display: block;
  width: 1.3rem;
  height: 1.3rem;
  object-fit: contain;
}

.nav-icon-plus {
  font-size: 1.9rem;
  line-height: 1;
  font-weight: 300;
}

.sidebar.is-collapsed .brand-image-full,
.sidebar.is-collapsed .nav-label {
  opacity: 0;
  transform: translateX(-6px);
  pointer-events: none;
}

.sidebar.is-collapsed .brand {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  overflow: visible;
}

.sidebar.is-collapsed .brand-image-icon {
  left: 0;
  opacity: 1;
  transform: translateY(-50%);
  pointer-events: auto;
}

.library-main {
  flex: 1;
  padding: 1.75rem 2rem 3rem;
}

.page-header,
.search-panel,
.search-controls,
.chip-row,
.section-head {
  display: flex;
  gap: 1rem;
}

.page-header,
.section-head {
  align-items: center;
  justify-content: space-between;
}

.page-kicker {
  margin: 0 0 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-header h1,
.section-head h2,
.theme-details h3 {
  margin: 0;
}

.page-copy,
.search-copy p {
  color: var(--muted);
}

.search-panel {
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.search-copy {
  max-width: 420px;
}

.search-controls {
  flex: 1;
  flex-direction: column;
  max-width: 620px;
}

input[type="search"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  outline: none;
}

input[type="search"]:focus {
  border-color: #3a3a3a;
}

.chip-row {
  flex-wrap: wrap;
}

.chip {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.82rem;
}

.section-head {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
}

.theme-card {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #000000;
  color: #fdfdfd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.14);
}

.theme-image {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.03)),
    #d8dbe2;
  color: #4a4f59;
  font-size: 0.92rem;
}

.theme-preview-link {
  display: block;
}

.theme-image-default {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.08), transparent 32%),
    linear-gradient(135deg, #111217, #1a1c23 64%, #0b0c10);
}

.theme-image-spotlight {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(6, 7, 12, 0.84), rgba(6, 7, 12, 0.92)),
    url("./spotlight/assets/background.jpg") center / cover no-repeat;
}

.theme-image-retroworld {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(32, 61, 87, 0.82), rgba(32, 61, 87, 0.82)),
    url("./retroworld/assets/background.jpg") center / cover no-repeat;
}

.mini-theme-layout {
  display: grid;
  gap: 0.6rem;
  width: 90%;
  height: 86%;
  align-content: start;
}

.mini-hero {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 0.7rem;
  align-items: start;
}

.mini-avatar-panel,
.mini-info-card,
.mini-stats-card,
.mini-links-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.mini-avatar-panel {
  display: grid;
  gap: 0.55rem;
  min-height: 104px;
  padding: 0.7rem;
  border-radius: 22px;
}

.mini-avatar-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.22;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.16)),
    url("./defaultstate/assets/user.jpg") center / cover no-repeat;
}

.mini-pill {
  display: block;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-pill-top {
  margin-top: 0.15rem;
}

.mini-pill-bottom {
  margin-top: auto;
}

.mini-intro-panel {
  display: grid;
  gap: 0.42rem;
  padding-top: 0.15rem;
}

.mini-kicker,
.mini-title,
.mini-handle,
.mini-copy,
.mini-actions span,
.mini-stats-card span,
.mini-links-card span,
.mini-media-row span {
  display: block;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.mini-kicker {
  width: 30%;
  height: 5px;
}

.mini-title {
  width: 78%;
  height: 10px;
}

.mini-handle {
  width: 48%;
  height: 7px;
}

.mini-copy {
  width: 100%;
  height: 6px;
}

.mini-copy.short {
  width: 72%;
}

.mini-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.1rem;
}

.mini-actions span {
  width: 48px;
  height: 18px;
  background: rgba(255, 255, 255, 0.09);
}

.mini-card-grid {
  display: grid;
  grid-template-columns: 1fr 0.82fr;
  gap: 0.4rem;
}

.mini-card-grid-default {
  grid-template-columns: 1fr 0.72fr;
}

.mini-info-card,
.mini-stats-card,
.mini-links-card {
  min-height: 36px;
  border-radius: 12px;
}

.mini-info-card {
  min-height: 42px;
}

.mini-info-card.hero {
  min-height: 34px;
}

.mini-info-card.alt {
  min-height: 46px;
}

.mini-stats-card,
.mini-links-card {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 0.3rem;
}

.mini-stats-card span {
  width: 16px;
  height: 16px;
}

.mini-links-card span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.mini-media-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.mini-actions-default {
  justify-content: flex-start;
}

.mini-actions-default span {
  width: 58px;
  height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.03);
}

.mini-retro-layout {
  display: grid;
  gap: 0.5rem;
  width: 90%;
  height: 86%;
  padding: 0.45rem;
  border: 2px solid #fbcb3e;
  border-radius: 22px;
  background: #912a2d;
}

.mini-retro-browser,
.mini-retro-hero,
.mini-retro-panel,
.mini-retro-footer span {
  border: 2px solid #fbcb3e;
  background: #357d77;
}

.mini-retro-browser {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  min-height: 20px;
  padding: 0 0.35rem;
  border-radius: 999px;
}

.mini-retro-browser span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f8e2b9;
}

.mini-retro-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  align-items: start;
  min-height: 80px;
  padding: 0.55rem;
  border-radius: 16px;
}

.mini-retro-headline {
  display: grid;
  gap: 0.24rem;
}

.mini-retro-profile {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 0.45rem;
  align-items: center;
}

.mini-retro-stamp {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.03), rgba(0, 0, 0, 0.1)),
    url("./retroworld/assets/user.jpg") center / cover no-repeat;
}

.mini-retro-socials {
  display: flex;
  gap: 0.3rem;
}

.mini-retro-socials span {
  width: 18px;
  height: 18px;
  border: 2px solid #fbcb3e;
  border-radius: 8px;
  background: #357d77;
}

.mini-retro-kicker,
.mini-retro-title,
.mini-retro-line {
  display: block;
  height: 6px;
  border-radius: 999px;
  background: #f8e2b9;
}

.mini-retro-kicker {
  width: 24%;
  height: 4px;
}

.mini-retro-title {
  width: 54%;
  height: 9px;
}

.mini-retro-line {
  width: 94%;
  background: #203d57;
}

.mini-retro-line.short {
  width: 68%;
}

.mini-retro-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.mini-retro-panel {
  min-height: 32px;
  border-radius: 14px;
}

.mini-retro-panel.tall {
  grid-row: span 2;
  min-height: 70px;
  background: #f8e2b9;
}

.mini-retro-footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.mini-retro-footer span {
  min-height: 18px;
  border-radius: 999px;
}

.mini-media-row span {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
}

.mini-spotlight-layout {
  display: grid;
  gap: 0.55rem;
  width: 90%;
  height: 86%;
  align-content: start;
}

.mini-spotlight-banner,
.mini-spotlight-feature,
.mini-spotlight-gallery span,
.mini-spotlight-actions span,
.mini-spotlight-avatar {
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-spotlight-banner {
  min-height: 50px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.12)),
    url("./spotlight/assets/cover.jpg") center / cover no-repeat;
}

.mini-spotlight-head {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.45rem;
  align-items: center;
  margin-top: -14px;
}

.mini-spotlight-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.18)),
    url("./spotlight/assets/user.jpg") center / cover no-repeat;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.mini-spotlight-copy {
  display: grid;
  gap: 0.3rem;
}

.mini-spotlight-feature {
  min-height: 78px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.03);
}

.mini-spotlight-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.mini-spotlight-actions span {
  min-height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-spotlight-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.mini-spotlight-gallery span {
  min-height: 44px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
}

.theme-details {
  padding: 0.9rem 0.2rem 0.8rem;
}

.theme-details h3 {
  font-size: 1.02rem;
}

.apply-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  background: #323232;
  color: #feffff;
  font-weight: 600;
}

.apply-button:disabled {
  cursor: default;
  opacity: 1;
}

.apply-button.is-applied {
  background: #f5f5f5;
  color: #000000;
}

.library-status {
  min-height: 1.25rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.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: 1200px) {
  .theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .search-panel {
    flex-direction: column;
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    z-index: 30;
    width: 100%;
    height: auto;
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(14px);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.35);
    transition: none;
  }

  .sidebar.is-collapsed {
    width: 100%;
    height: auto;
    padding: 0.55rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.94);
    box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.35);
  }

  .sidebar.is-collapsed .sidebar-nav {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  .brand-row,
  .sidebar-account-row {
    display: none;
  }

  .sidebar-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.35rem;
  }

  .nav-link {
    justify-content: center;
    min-height: 56px;
    padding: 0.55rem 0.25rem;
    border-radius: 16px;
  }

  .nav-label {
    display: none;
  }

  .nav-icon {
    width: 2.1rem;
    height: 2.1rem;
  }

  .nav-icon-image {
    width: 1.45rem;
    height: 1.45rem;
  }

  .library-main {
    padding: 1rem 1rem calc(6.5rem + env(safe-area-inset-bottom));
  }

  .page-header,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .search-panel {
    padding: 0.9rem;
  }

  input[type="search"] {
    padding: 0.85rem 0.95rem;
  }

  .theme-grid {
    grid-template-columns: 1fr;
  }
}
