:root {
  color-scheme: dark;
  --bg: #0a0710;
  --panel: #16101f;
  --panel-2: #21152d;
  --text: #f7f2fa;
  --muted: #b9a9c4;
  --accent: #ff50f0;
  --accent-dark: #5e1359;
  --border: rgba(255,255,255,.12);
  --danger: #ff6d7a;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background-color: black;
  margin: 0;
  background: radial-gradient(circle at top, #24112c 0, var(--bg) 42rem);
  color: var(--text);
  font-family: Inter, Avenir, system-ui, sans-serif;
}
button, input, select, textarea { font: inherit; }
button, .action-link {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  padding: .65rem .85rem;
  cursor: pointer;
}
button:hover, .action-link:hover { border-color: var(--accent); }
a { color: inherit; }
.site-header {
  min-height: 64px;
  padding: 0 clamp(1rem, 4vw, 4rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(10,7,16,.88);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { text-decoration: none; font-weight: 900; letter-spacing: .12em; }
.site-header nav { display: flex; gap: 1.25rem; }
.site-header nav a { text-decoration: none; color: var(--muted); }
.site-header nav a:hover { color: var(--accent); }

.page-shell, .admin-shell { width: min(1280px, calc(100% - 2rem)); margin: 2rem auto; }
.top-player {
  position: sticky;
  top: 78px;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.25rem;
  align-items: center;
  padding: 1rem;
  background: rgba(22,16,31,.94);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(0,0,0,.35);
  backdrop-filter: blur(18px);
}
.transport { display: flex; gap: .5rem; }
.primary-play { background: var(--accent); color: #150711; font-weight: 900; }
.now-title { font-weight: 700; margin-bottom: .5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-progress { display: grid; grid-template-columns: 3.5rem 1fr 3.5rem; gap: .6rem; align-items: center; font-size: .85rem; color: var(--muted); }
.player-progress input, .volume-control input { width: 100%; accent-color: var(--accent); }
.volume-control { display: flex; align-items: center; gap: .5rem; width: 180px; }

.collection-heading, .admin-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin: 2.5rem 0 1.25rem;
}
.collection-heading h1, .admin-heading h1 { margin: 0; font-size: 18px; }
.collection-heading p, .admin-heading p { color: var(--muted); }
.sort-control { display: grid; gap: .35rem; color: var(--muted); }
select, input, textarea {
  color: var(--text);
  background: #100b16;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: .7rem;
}
.track-list { display: grid; gap: 1.25rem; }
.track-card {
  padding: 1rem;
  background: linear-gradient(135deg, rgba(33,21,45,.95), rgba(17,11,24,.95));
  border: 1px solid var(--border);
  border-radius: 14px;
  transition: border-color .2s, transform .2s;
}
.track-card.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-dark); }
.track-main { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; }
.artwork-button { padding: 0; border: 0; overflow: hidden; aspect-ratio: 1; background: #0d0912; }
.artwork-button img { width: 100%; height: 100%; object-fit: cover; display: block; }
.artwork-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--muted); font-weight: 900; }
.track-wave-area { min-width: 0; }
.waveform {
  width: 100%;
  height: 78px;
  display: block;
  border-radius: 9px;
  cursor: pointer;
  background: rgba(0,0,0,.22);
}
.track-identification { display: flex; justify-content: space-between; gap: 1rem; align-items: end; margin-top: .75rem; }
.track-identification h2 { margin: 0; }
.artist { margin: .2rem 0 0; color: var(--accent); }
.metadata { display: flex; flex-wrap: wrap; justify-content: end; gap: .5rem; color: var(--muted); }
.metadata span:not(:last-child)::after { content: " ·"; }
.track-actions { display: flex; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.track-actions .liked { color: var(--accent); border-color: var(--accent); }
.action-link { text-decoration: none; display: inline-flex; align-items: center; }
.description {
  position: relative;
  width: min(600px, 100%);
  margin-top: 1rem;
  color: var(--muted);
  line-height: 1.55;
}
.description.collapsed .description-text {
  max-height: 4.65em;
  overflow: hidden;
}
.description-toggle { margin-top: .35rem; background: transparent; padding: 0; border: 0; color: var(--accent); }
.comments-panel { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.comment { padding: .75rem 0; border-bottom: 1px solid var(--border); }
.comment p { margin: .25rem 0; }
.comment time { color: var(--muted); font-size: .8rem; }
.comment-form { display: grid; grid-template-columns: minmax(160px, .4fr) 1fr auto; gap: .6rem; margin-top: 1rem; }
.comment-status { grid-column: 1 / -1; color: var(--muted); }
.honeypot { position: absolute !important; left: -10000px !important; }
.empty-state { text-align: center; padding: 5rem 1rem; color: var(--muted); }

.artwork-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.86);
  padding: 20px;
}
.artwork-modal[hidden] { display: none; }
.artwork-dialog { position: relative; width: min(500px, calc(100vw - 40px)); height: min(500px, calc(100vw - 40px)); }
.artwork-dialog img { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.modal-close { position: absolute; top: 8px; right: 8px; z-index: 2; width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 1.7rem; background: rgba(0,0,0,.7); }

.site-footer { text-align: center; padding: 3rem 1rem; color: var(--muted); border-top: 1px solid var(--border); }
.social-links { display: flex; justify-content: center; gap: .75rem; }
.social-links a { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; text-decoration: none; border: 1px solid var(--border); }

.login-shell { min-height: 70vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(420px, 100%); display: grid; gap: 1rem; background: var(--panel); padding: 2rem; border: 1px solid var(--border); border-radius: 14px; }
.login-card label { display: grid; gap: .4rem; }

.flash-stack { width: min(900px, calc(100% - 2rem)); margin: 1rem auto; }
.flash { padding: .85rem 1rem; border-radius: 8px; background: var(--panel); border: 1px solid var(--border); }
.flash.error { border-color: var(--danger); }
.flash.success { border-color: var(--accent); }

.admin-toolbar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: end; background: var(--panel); padding: 1rem; border-radius: 12px; border: 1px solid var(--border); }
.upload-form { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; }
.upload-form h2 { width: 100%; margin: 0; }
.admin-list { display: grid; gap: 1.25rem; margin-top: 1.25rem; }
.admin-track { padding: 1rem; border: 1px solid var(--border); background: var(--panel); border-radius: 12px; }
.admin-track header { display: flex; justify-content: space-between; gap: 1rem; }
.admin-track h2 { margin: .3rem 0 1rem; }
.collection-badge { text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-size: .75rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 260px; gap: 1.5rem; }
.admin-grid > form { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
.admin-grid label { display: grid; gap: .35rem; color: var(--muted); }
.admin-grid .full { grid-column: 1 / -1; }
.admin-grid .check { display: flex; align-items: center; gap: .5rem; }
.artwork-admin img, .artwork-admin .artwork-placeholder { width: 220px; height: 220px; object-fit: cover; background: #0e0913; }
.artwork-admin form { display: grid; gap: .65rem; margin-top: .75rem; }
.comment-admin { margin: 1rem 0; border-top: 1px solid var(--border); padding-top: 1rem; }
.admin-comment { display: flex; justify-content: space-between; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.danger { color: var(--danger); }
.secondary { background: transparent; }

@media (max-width: 760px) {
  .top-player {
    top: 82px;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    gap: 0.8rem;
    overflow: hidden;
  }

  .now-playing {
    min-width: 0;
    width: 100%;
  }

  .player-progress {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    width: 100%;
    min-width: 0;
    gap: 0.35rem;
  }

  .player-progress input {
    min-width: 0;
    width: 100%;
  }

  .volume-control {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .volume-control input {
    min-width: 0;
    width: 100%;
  }  
  .site-header { align-items: flex-start; padding-block: 1rem; }
  .site-header nav { gap: .7rem; flex-wrap: wrap; justify-content: end; }
  .top-player { top: 82px; grid-template-columns: 1fr; }
  .volume-control { width: 100%; }
  .track-main { grid-template-columns: 88px 1fr; }
  .waveform { height: 95px; }
  .track-identification { display: block; }
  .metadata { justify-content: start; margin-top: .5rem; }
  .comment-form { grid-template-columns: 1fr; }
  .collection-heading { align-items: stretch; flex-direction: column; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-grid > form { grid-template-columns: 1fr; }
  .admin-grid .full { grid-column: auto; }
}

.top-player,
.now-playing,
.player-progress,
.volume-control {
  min-width: 0;
}

/* Live page */
.live-heading { align-items: center; }
.twitch-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 1rem;
  align-items: stretch;
}
.twitch-player-frame,
.twitch-chat-frame {
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 15px 40px rgba(0,0,0,.28);
}
.twitch-player-frame { aspect-ratio: 16 / 9; }
.twitch-player-frame iframe,
.twitch-chat-frame iframe { width: 100%; height: 100%; display: block; }
.twitch-chat-frame { min-height: 420px; }
.stream-schedule-section { margin-top: 2rem; }
.schedule-heading { margin-bottom: 1rem; }
.schedule-heading h2 { margin: 0; font-size: 18px; }
.schedule-list { display: grid; gap: .75rem; }
.schedule-card {
  display: grid;
  grid-template-columns: minmax(145px, auto) 1fr;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(33,21,45,.95), rgba(17,11,24,.95));
  border: 1px solid var(--border);
  border-radius: 12px;
}
.schedule-date time { display: grid; gap: .2rem; color: var(--muted); }
.schedule-date strong { color: var(--accent); font-size: 1.1rem; }
.schedule-details { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.schedule-details h3 { margin: 0; }
.schedule-empty { padding: 3rem 1rem; border: 1px solid var(--border); border-radius: 12px; }

/* Admin stream schedule */
.stream-schedule-admin {
  margin: 0 0 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.stream-schedule-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: left;
}
.stream-schedule-toggle[aria-expanded="true"] { border-bottom: 1px solid var(--border); }
.toggle-symbol { color: var(--accent); font-size: 1.45rem; line-height: 1; }
.stream-schedule-admin-body { padding: 1rem; }
.stream-schedule-admin-body[hidden] { display: none; }
.schedule-form {
  display: grid;
  grid-template-columns: minmax(150px, .55fr) minmax(130px, .45fr) minmax(220px, 1fr) minmax(240px, 1fr) auto;
  gap: .75rem;
  align-items: end;
}
.schedule-form label { display: grid; gap: .35rem; color: var(--muted); }
.admin-schedule-list { display: grid; gap: .6rem; margin-top: 1rem; }
.admin-schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0,0,0,.16);
}
.admin-schedule-item > div { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; }
.admin-schedule-item span { color: var(--muted); }
.admin-schedule-item a { color: var(--accent); }
.muted-copy { color: var(--muted); }

@media (max-width: 980px) {
  .twitch-layout { grid-template-columns: 1fr; }
  .twitch-chat-frame { min-height: 500px; }
  .schedule-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .schedule-title-field, .schedule-link-field { grid-column: span 2; }
  .schedule-form button { width: max-content; }
}

@media (max-width: 600px) {
  .live-heading { align-items: stretch; flex-direction: column; }
  .twitch-chat-frame { min-height: 430px; }
  .schedule-card { grid-template-columns: 1fr; }
  .schedule-details { align-items: flex-start; flex-direction: column; }
  .schedule-form { grid-template-columns: 1fr; }
  .schedule-title-field, .schedule-link-field { grid-column: auto; }
  .schedule-form button { width: 100%; }
  .admin-schedule-item { align-items: flex-start; }
}


.shop-page,
.product-page {
    width: min(1400px, calc(100% - 40px));
    margin: 0 auto;
    padding: 40px 0 60px;
}

.shop-header {
    margin-bottom: 30px;
    text-align: center;
}

.shop-header h1 {
    margin-bottom: 10px;
}

.product-grid {
    display: grid;
    grid-template-columns:
        repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.product-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    background: #181818;
    transition:
        transform 0.2s ease,
        border-color 0.2s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    border-color: #ff50f0;
}

.product-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.product-image-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;

    background: transparent;
}

.product-image,
.product-detail-image {
    display: block;
    width: auto;
    height: 500px;
    object-fit: contain;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-card-content {
    padding: 18px;
}

.product-card-content h2 {
    margin: 0 0 10px;
    font-size: 18px;
}

.product-price {
    margin: 0;
    font-weight: 700;
}

.product-image-placeholder {
    display: grid;
    width: 100%;
    min-height: 300px;
    place-items: center;
    background: #eeeeee;
    color: #50003c;
}

.product-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
    gap: 50px;
    align-items: start;
}

.product-gallery {
    aspect-ratio: 3 / 4;
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;

    background: transparent;
    border-radius: 10px;
}

.product-detail-image {
    display: block;
    width: 100%;
    max-width: 450px;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
}

.product-information h1 {
    margin-top: 10px;
}

.product-description {
    margin: 20px 0;
    line-height: 1.7;
}

.product-purchase-form {
    display: grid;
    gap: 12px;
    margin-top: 30px;
}

.product-purchase-form select,
.product-purchase-form input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background: #111111;
    color: #ffffff;
}

.shop-button {
    min-height: 48px;
    margin-top: 10px;
    border: 0;
    border-radius: 6px;
    background: #ff50f0;
    color: #111111;
    font-weight: 700;
    cursor: pointer;
}

.shop-button:hover {
    filter: brightness(1.1);
}

.product-back-link a {
    color: #ff50f0;
}

.shop-message {
    padding: 20px;
    text-align: center;
}

.shop-error {
    border: 1px solid #ff7777;
    border-radius: 6px;
}

.product-unavailable {
    opacity: 0.7;
}

@media (max-width: 820px) {
    .shop-page,
    .product-page {
        width: min(100% - 24px, 1400px);
        padding-top: 25px;
    }

    .product-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .product-card-content {
        padding: 12px;
    }

    .product-card-content h2 {
        font-size: 15px;
    }
}

.product-image-wrapper,
.product-gallery {
    background: inherit;
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
    }
}

.shop-collections {
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

.shop-collection {
    width: 100%;
}

.collection-header {
    margin-bottom: 1.5rem;
}

.collection-header h2 {
    margin: 0 0 0.5rem;
    font-size: 1.75rem;
}

.collection-description {
    max-width: 750px;
    line-height: 1.6;
    opacity: 0.8;
}

.collection-description p {
    margin: 0;
}

.shop-collection + .shop-collection {
    padding-top: 3rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.shop-collection {
    scroll-margin-top: 100px;
}

.collection-menu {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-bottom: 3rem;
}

.collection-menu a {
    color: inherit;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.collection-menu a:hover,
.collection-menu a:focus-visible {
    opacity: 0.65;
    text-decoration: underline;
}

.collection-footer {
    margin-top: 2rem;
    text-align: center;
}

.back-to-top {
    display: inline-block;
    color: inherit;
    text-decoration: none;
    font-weight: 600;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
    opacity: 1;
    text-decoration: underline;
}

#collection-menu {
    scroll-margin-top: 100px;
}

html {
    scroll-behavior: smooth;
}

.product-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.product-main-image {
    width: 100%;
    display: flex;
    justify-content: center;
}

.product-main-image img {
    width: 100%;
    max-width: 450px;
    max-height: 550px;
    object-fit: contain;
}

.product-thumbnails {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
}

.product-thumbnail {
    width: 72px;
    height: 72px;
    padding: 4px;
    border: 1px solid #555;
    background: transparent;
    cursor: pointer;
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.product-thumbnail:hover,
.product-thumbnail:focus-visible,
.product-thumbnail.active {
    opacity: 1;
    border-color: currentColor;
}

@media (max-width: 600px) {
    .product-main-image img {
        max-width: 100%;
        max-height: 420px;
    }

    .product-thumbnails {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
    }

    .product-thumbnail {
        flex: 0 0 64px;
        width: 64px;
        height: 64px;
    }
}

@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }
}