:root {
  color-scheme: dark;
  font-family: ui-rounded, "Trebuchet MS", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #17121f;
  color: #fff8ff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
    background: #ffc8e9;
}
button, input, select { font: inherit; }
a { color: inherit; }

.site-shell { width: min(1240px, calc(100% - 30px)); margin: 0 auto; padding: 34px 0 64px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: #dcbdf4; text-transform: uppercase; letter-spacing: .16em; font-size: 12px; font-weight: 800; }
h1 { margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: .95; letter-spacing: -.035em; }
.lede { max-width: 720px; margin: 14px 0 0; color: #000000; line-height: 1.6; }
.local-play { white-space: nowrap; text-decoration: none; border: 1px solid rgba(255,255,255,.2); background: #3d2b50; padding: 12px 16px; border-radius: 999px; box-shadow: 0 10px 35px rgba(0,0,0,.22); }
.local-play:hover { background: #54386c; }

.library-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 14px; border: 1px solid rgba(255,255,255,.13); background: rgba(25,18,34,.82); border-radius: 18px; box-shadow: 0 18px 55px rgba(0,0,0,.2); }
.library-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    padding: 14px;
    /* border: 1px solid rgba(255, 255, 255, .13); */
    background: rgb(131 95 157);
    border-radius: 18px;
    /* box-shadow: 0 18px 55px rgba(0, 0, 0, .2); */
}
.search-box { flex: 1 1 340px; }
input, select { min-height: 42px; border: 1px solid rgba(255,255,255,.15); background: #231a2d; color: white; border-radius: 11px; padding: 8px 12px; outline: none; }
input:focus, select:focus { border-color: #d9aaff; box-shadow: 0 0 0 3px rgba(217,170,255,.12); }
.library-tools strong { margin-left: auto; align-self: center; color: #bdb0c8; font-size: 13px; }

.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; min-height: 18px; margin: 16px 2px 18px; }
.tag-button {
    border: 1px solid rgba(255, 255, 255, .13);
    background: #ff83cd;
    color: #000000;
    padding: 7px 11px;
    border-radius: 999px;
    cursor: pointer;
}
.tag-button:hover, .tag-button.active { background: #785294; border-color: #b993d4; }

.doll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.doll-card {
    overflow: hidden;
    border: 1px solid rgb(0 0 0);
    background: #c3a2db;
    /* border-radius: 18px; */
    box-shadow: 0 10px 10px rgb(81 0 140 / 30%);
    /* transition: transform .15s ease, border-color .15s ease; */
}
.doll-card:hover { transform: translateY(-3px); border-color: rgba(226,187,255,.42); }
.cover-link { display: block; text-decoration: none; }
.cover-wrap { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: linear-gradient(145deg, #34243e, #1e1727); }
.cover { display: none; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.cover.loaded { display: block; }
.cover-placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 68px; color: rgba(235,198,255,.6); background: repeating-linear-gradient(45deg, transparent 0 16px, rgba(255,255,255,.025) 16px 32px); }
.cover.loaded + .cover-placeholder { display: none; }
.play-badge { position: absolute; right: 11px; bottom: 11px; padding: 7px 10px; border-radius: 999px; background: rgba(18,12,24,.88); border: 1px solid rgba(255,255,255,.16); font-size: 12px; font-weight: 800; }
.card-body { padding: 14px 15px 16px; }
.title-row { display: flex; align-items: baseline; gap: 10px; }
.doll-title { flex: 1; min-width: 0; margin: 0; font-size: 20px; line-height: 1.15; overflow-wrap: anywhere; }
.doll-year { color: #a99db2; font-size: 12px; }
.doll-artist { margin: 7px 0 0; color: #000000; font-size: 13px; min-height: 1em; }
.doll-description { margin: 10px 0 0; color: #5c5c5c; font-size: 13px; line-height: 1.45; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card-tag {
    padding: 4px 7px;
    border-radius: 999px;
    background: #652f8c;
    color: #ffffff;
    font-size: 11px;
}
.empty-state { grid-column: 1 / -1; padding: 42px 20px; text-align: center; border: 1px dashed rgba(255,255,255,.16); border-radius: 18px; color: #bfb2c7; }

#libraryStatus {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.library-spinner {
  width: 16px;
  height: 16px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: currentColor;
  border-radius: 50%;
  display: inline-block;
  animation: library-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes library-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 700px) {
  .site-shell { width: min(100% - 16px, 1240px); padding-top: 16px; }
  .hero { display: grid; align-items: start; }
  .local-play { justify-self: start; }
  .library-tools strong { width: 100%; margin-left: 0; }
}
