:root {
  --ink: #1f1d19;
  --charcoal: #2c2a24;
  --sand: #f6f0e6;
  --mist: #eef3f1;
  --ring-yellow: #f3c623;
  --ring-orange: #f08a24;
  --ring-red: #e65745;
  --ring-purple: #8b4fbf;
  --ring-blue: #4a78c9;
  --sea: var(--ring-blue);
  --moss: #5c7355;
  --clay: var(--ring-red);
  --gold: var(--ring-yellow);
  --panel: rgba(255, 255, 255, 0.88);
  --border: rgba(31, 29, 25, 0.12);
  --shadow-soft: 0 8px 16px rgba(31, 29, 25, 0.12), 0 18px 36px rgba(31, 29, 25, 0.14);
  --shadow-lift: 0 10px 20px rgba(31, 29, 25, 0.16), 0 24px 48px rgba(31, 29, 25, 0.18);
  --shadow-inset: inset 0 1px 2px rgba(31, 29, 25, 0.12), inset 0 -1px 2px rgba(255, 255, 255, 0.5);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "Futura", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 12% 18%, rgba(243, 198, 35, 0.34), transparent 48%),
    radial-gradient(circle at 70% 12%, rgba(240, 138, 36, 0.3), transparent 48%),
    radial-gradient(circle at 88% 72%, rgba(138, 79, 191, 0.28), transparent 50%),
    radial-gradient(circle at 12% 86%, rgba(74, 120, 201, 0.28), transparent 50%),
    linear-gradient(140deg, #fbf4e6 0%, #eef2f9 52%, #f6ebe6 100%);
}

.app-shell {
  padding: 24px;
}

.topbar,
.panel,
.catalog-card,
.folder-item,
.item-row,
.home-card,
.breadcrumb button {
  transition:
    transform 0.2s ease,
    box-shadow 0.25s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    filter 0.2s ease;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) minmax(220px, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  z-index: 2;
}

.brand-mark {
  width: 68px;
  height: 68px;
  border-radius: 20px;
  background: transparent;
  color: #fefcf8;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: none;
  font: inherit;
  padding: 0;
  box-shadow: none;
}

.home-button {
  cursor: pointer;
}

.home-button:hover {
  filter: brightness(1.05);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand::after {
  content: "";
  position: absolute;
  left: -24px;
  top: -12px;
  width: 180px;
  height: 180px;
  background: url("img/logo.png") no-repeat center / contain;
  opacity: 0.12;
  transform: translateY(56px);
  pointer-events: none;
  z-index: 0;
  filter: saturate(1.05);
}

.brand > * {
  position: relative;
  z-index: 1;
}

.home-view #listHeader,
.home-view #itemList,
.home-view #listFooter,
.home-view #emptyState {
  display: none;
}

.home-view .breadcrumb {
  display: none;
}

.home-panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  overflow: auto;
}

.home-view .home-panel {
  display: flex;
}

.home-hint {
  font-size: 0.9rem;
  color: rgba(31, 29, 25, 0.72);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.home-card {
  border: 1px solid transparent;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.8);
  padding: 16px 12px;
  text-align: center;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 29, 25, 0.18);
  box-shadow: 0 12px 24px rgba(31, 29, 25, 0.12);
}

.home-card.active {
  border-color: var(--sea);
  box-shadow: 0 12px 26px rgba(78, 122, 120, 0.25);
}

.home-icon {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  background: rgba(31, 29, 25, 0.08);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.home-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-id {
  font-weight: 700;
  letter-spacing: 0.04em;
}

.home-label {
  font-size: 0.75rem;
  color: rgba(31, 29, 25, 0.6);
}

.brand-title {
  font-family: "Segoe UI Variable", "Segoe UI", "Helvetica Neue", "SF Pro Display", "Arial", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-sub {
  font-size: 0.85rem;
  color: rgba(31, 29, 25, 0.7);
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-label,
.filter-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 29, 25, 0.6);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(31, 29, 25, 0.12);
  box-shadow: inset 0 1px 1px rgba(31, 29, 25, 0.08);
}

.search-field input {
  border: none;
  outline: none;
  flex: 1;
  background: transparent;
  font-size: 0.95rem;
  color: var(--charcoal);
}

.search-field button {
  border: none;
  background: var(--clay);
  color: #fffaf3;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.8rem;
}

.search-field button:hover {
  background: #ab5d43;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar select {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid rgba(31, 29, 25, 0.2);
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.85rem;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(31, 29, 25, 0.2);
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}

.toggle-chip input {
  width: 14px;
  height: 14px;
  accent-color: var(--sea);
}

.status {
  font-size: 0.8rem;
  color: rgba(31, 29, 25, 0.7);
}

.content {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 320px;
  gap: 16px;
  position: relative;
  z-index: 2;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

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

.panel-title {
  font-weight: 700;
  font-size: 1rem;
}

.panel-meta {
  font-size: 0.8rem;
  color: rgba(31, 29, 25, 0.7);
}

.panel-divider {
  height: 1px;
  background: rgba(31, 29, 25, 0.12);
  margin: 14px 0;
}

.panel-note {
  font-size: 0.78rem;
  color: rgba(31, 29, 25, 0.6);
}

.ghost {
  border: 1px solid rgba(31, 29, 25, 0.25);
  background: transparent;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.ghost:hover {
  border-color: var(--sea);
  color: var(--sea);
  box-shadow: 0 8px 16px rgba(78, 122, 120, 0.2);
}

.catalog-list,
.folder-list,
.item-list,
.detail-content,
.home-panel {
  overflow: auto;
  padding: 8px 10px;
  scrollbar-gutter: stable;
}

.catalog-list {
  flex: 0 0 auto;
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item-list {
  padding: 12px 10px 16px;
}

.detail-content {
  padding: 6px 6px 10px;
}

.catalog-card {
  width: 100%;
  text-align: left;
  font: inherit;
  border-radius: 14px;
  border: 1px solid transparent;
  padding: 12px 14px;
  background: rgba(248, 242, 234, 0.85);
  cursor: pointer;
  position: relative;
}

.catalog-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 29, 25, 0.18);
  box-shadow: var(--shadow-lift);
}

.catalog-card.active {
  border-color: var(--clay);
  box-shadow: 0 10px 20px rgba(192, 108, 79, 0.2), 0 22px 44px rgba(192, 108, 79, 0.2);
}

.catalog-name {
  font-weight: 700;
  margin-bottom: 6px;
}

.catalog-media {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 18px rgba(31, 29, 25, 0.2);
  background: rgba(255, 255, 255, 0.85);
}

.catalog-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.catalog-meta {
  font-size: 0.78rem;
  color: rgba(31, 29, 25, 0.68);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.folder-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.folder-item {
  border: none;
  background: rgba(78, 122, 120, 0.08);
  padding: 8px 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 8px;
  font: inherit;
}

.folder-item:hover {
  background: rgba(78, 122, 120, 0.18);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.5), 0 6px 16px rgba(31, 29, 25, 0.12);
}

.folder-item.active {
  background: rgba(78, 122, 120, 0.3);
  color: #1b2d2a;
}

.panel-footer {
  margin-top: auto;
}

.panel-callout {
  background: rgba(78, 122, 120, 0.12);
  padding: 12px;
  border-radius: 12px;
  font-size: 0.78rem;
  color: rgba(31, 29, 25, 0.75);
}

.callout-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.mono {
  font-family: "Cascadia Mono", "Courier New", monospace;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: rgba(31, 29, 25, 0.7);
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 29, 25, 0.1);
  box-shadow: var(--shadow-inset), 0 8px 18px rgba(31, 29, 25, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.breadcrumb button {
  border: none;
  background: rgba(31, 29, 25, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  box-shadow: var(--shadow-inset);
}

.breadcrumb button:hover {
  background: rgba(31, 29, 25, 0.18);
  transform: translateY(-1px);
}

.list-header {
  display: grid;
  grid-template-columns: minmax(200px, 2.2fr) minmax(120px, 1.3fr) 0.8fr 1fr;
  gap: 12px;
  padding: 6px 10px 8px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(31, 29, 25, 0.55);
  border-bottom: 1px solid rgba(31, 29, 25, 0.12);
}

.item-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
}

.list-footer {
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}

.item-row {
  display: grid;
  grid-template-columns: minmax(200px, 2.2fr) minmax(120px, 1.3fr) 0.8fr 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.75);
}

.item-row:hover {
  border-color: rgba(31, 29, 25, 0.2);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 6px 14px rgba(31, 29, 25, 0.12), 0 14px 30px rgba(31, 29, 25, 0.1);
}

.item-row.active {
  border-color: var(--sea);
  box-shadow: 0 8px 16px rgba(78, 122, 120, 0.18), 0 18px 36px rgba(78, 122, 120, 0.16);
}

.item-name {
  display: flex;
  align-items: center;
  gap: 10px;
}

.item-icon {
  width: 34px;
  height: 34px;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  color: rgba(31, 29, 25, 0.7);
  overflow: hidden;
}

.item-icon.text-fallback {
  background: rgba(31, 29, 25, 0.1);
  border-radius: 6px;
}

.item-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.item-title {
  font-weight: 600;
}

.item-subtitle {
  font-size: 0.78rem;
  color: rgba(31, 29, 25, 0.6);
  margin-top: 2px;
}

.item-rating {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  background: rgba(78, 122, 120, 0.16);
  color: rgba(31, 29, 25, 0.7);
}

.badge.drive-id {
  background: #1f2d2b;
  color: #f5fbf9;
  font-weight: 700;
  letter-spacing: 0.03em;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.empty-state {
  padding: 24px;
  font-size: 0.9rem;
  color: rgba(31, 29, 25, 0.7);
}

.detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-empty {
  color: rgba(31, 29, 25, 0.6);
}

.detail-hero {
  display: flex;
  gap: 12px;
  align-items: center;
}

.detail-hero-text {
  align-items: flex-start;
}

.detail-thumb {
  width: 84px;
  height: 84px;
  border-radius: 0;
  background: transparent;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.detail-thumb.text-fallback {
  background: rgba(31, 29, 25, 0.08);
  border-radius: 10px;
}

.detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.detail-banner {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(31, 29, 25, 0.08);
  margin-bottom: 12px;
}

.detail-banner img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 320px;
  object-fit: cover;
}

.detail-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.detail-path {
  font-size: 0.8rem;
  color: rgba(31, 29, 25, 0.7);
  word-break: break-all;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

.detail-card {
  padding: 10px;
  border-radius: 12px;
  background: rgba(248, 242, 234, 0.8);
  border: 1px solid rgba(31, 29, 25, 0.08);
  font-size: 0.8rem;
  box-shadow: var(--shadow-inset);
}

.detail-card.drive-id-card {
  background: #1f2d2b;
  color: #f5fbf9;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.12);
}

.detail-card.drive-id-card span {
  color: rgba(245, 251, 249, 0.7);
}

.detail-card span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(31, 29, 25, 0.55);
  margin-bottom: 4px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-actions button {
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--sea);
  color: #f7fbfa;
  cursor: pointer;
  font-size: 0.8rem;
  box-shadow: 0 8px 16px rgba(78, 122, 120, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.2);
}

.detail-actions button.secondary {
  background: rgba(31, 29, 25, 0.1);
  color: var(--charcoal);
}

.rating-card {
  grid-column: 1 / -1;
}

.rating-stars {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.rating-stars button {
  border: none;
  background: transparent;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
}

.rating-stars button img {
  width: 100%;
  height: 100%;
  display: block;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.rating-stars button:not(.active) img {
  opacity: 0.45;
}

.rating-stars button:hover img {
  transform: translateY(-1px) scale(1.04);
}

.catalog-photos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.catalog-photo {
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(31, 29, 25, 0.08);
  box-shadow: 0 8px 16px rgba(31, 29, 25, 0.12), 0 18px 36px rgba(31, 29, 25, 0.12);
}

.catalog-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  display: block;
}

.catalog-photo-label {
  padding: 8px 10px;
  font-size: 0.75rem;
  color: rgba(31, 29, 25, 0.7);
}

.detail-panel {
  position: sticky;
  top: 24px;
  align-self: start;
  height: calc(100vh - 48px);
}

.detail-panel.shelf-bg {
  background-image: url("img/shelf.png");
  background-repeat: no-repeat;
  background-position: right bottom;
  background-size: auto 85%;
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.panel,
.home-card,
.folder-item {
  animation: floatIn 0.4s ease;
}

.nav-panel {
  animation: none;
}

.catalog-card {
  animation: none;
}

.detail-content > * {
  animation: riseIn 0.45s ease;
}

.item-list.animate-enter .item-row {
  animation: floatIn 0.6s ease;
  animation-fill-mode: both;
}

.home-card:hover .home-icon img {
  transform: scale(1.04);
}

.home-icon img {
  transition: transform 0.2s ease;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .toolbar {
    justify-content: flex-start;
  }

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

  .nav-panel,
  .detail-panel {
    order: 2;
  }

  .detail-panel {
    position: static;
    height: auto;
  }

  .main-panel {
    order: 1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

  .item-row,
  .list-header {
    grid-template-columns: 1fr 0.8fr;
  }

  .list-header span:nth-child(3),
  .list-header span:nth-child(4),
  .item-row div:nth-child(3),
  .item-row div:nth-child(4) {
    display: none;
  }
}
