:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #6b7280;
  --line: #deded8;
  --accent: #e11d48;
  --accent-dark: #be123c;
  --focus: #2563eb;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) minmax(240px, 560px) minmax(max-content, 1fr);
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px clamp(16px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.site-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f7f7;
}

.site-search:focus-within {
  border-color: #a1a1aa;
  background: #fff;
}

.site-search img {
  width: 18px;
  height: 18px;
  opacity: 0.55;
}

.site-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
}

.upload-toggle,
.account-create-link,
.login-link,
.account-button,
.primary-action,
.delete-button,
.logout-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.upload-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  background: #111827;
  color: #fff;
  text-decoration: none;
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
}

.guest-actions,
.member-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.guest-actions[hidden],
.member-actions[hidden] {
  display: none;
}

.account-create-link,
.login-link {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  text-decoration: none;
}

.account-create-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.login-link {
  background: #111827;
  color: #fff;
}

.logout-button {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  background: #f3f4f6;
  color: #3f3f46;
  text-decoration: none;
}

.logout-button:hover {
  color: var(--accent-dark);
}

.account-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  background: #f3f4f6;
  color: #3f3f46;
  text-decoration: none;
}

.account-button:hover {
  background: #e9eaec;
  color: var(--accent-dark);
}

.account-button img {
  width: 19px;
  height: 19px;
}

.dashboard-page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px);
}

.dashboard-header,
.dashboard-section {
  border-bottom: 1px solid var(--line);
  padding: 24px 0;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.dashboard-identity {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dashboard-avatar {
  width: 52px;
  height: 52px;
  padding: 12px;
  border-radius: 50%;
  background: #f3f4f6;
}

.dashboard-header h1,
.dashboard-section h2 {
  margin: 0;
}

.dashboard-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.dashboard-video-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.dashboard-video {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
}

.dashboard-video img,
.dashboard-video-placeholder {
  width: 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  object-fit: cover;
  background: #18181b;
}

.dashboard-video h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.dashboard-video p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: clamp(16px, 3vw, 26px);
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(14px, 3vw, 30px);
}

.watch-area {
  min-width: 0;
}

.player-frame {
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
  border-radius: 8px;
  background: #0f0f0f;
  box-shadow: var(--shadow);
}

.player-frame.audio-mode {
  aspect-ratio: auto;
  min-height: clamp(420px, 58vh, 620px);
  background: #171719;
}

.player-frame video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.audio-player {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  align-content: end;
  gap: 26px;
  height: 100%;
  min-height: inherit;
  padding: clamp(24px, 5vw, 46px);
  color: #fff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.14)),
    #171719;
}

.audio-controls-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.audio-controls-row audio {
  width: 100%;
  margin-top: 2px;
  accent-color: var(--accent);
}

.loop-button {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #f4f4f5;
  color: #27272a;
  cursor: pointer;
  font-weight: 800;
}

.loop-button.active {
  background: var(--accent);
  color: #fff;
}

.album-art {
  display: grid;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #111113;
  color: #fff;
  font-size: 70px;
  box-shadow: 0 18px 45px rgba(225, 29, 72, 0.24);
}

.album-art.has-cover {
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.album-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.audio-copy {
  align-self: center;
  min-width: 0;
}

.audio-player h2 {
  margin: 4px 0 8px;
  overflow-wrap: anywhere;
  color: #fff;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
}

.audio-player p {
  margin: 0;
  color: #d4d4d8;
}

.audio-eyebrow {
  color: #fda4af;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.waveform {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(48, 1fr);
  align-items: center;
  gap: 3px;
  height: 96px;
  margin-top: clamp(18px, 5vw, 56px);
}

.waveform span {
  display: block;
  min-height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fb7185, #e11d48);
  opacity: 0.86;
}

.empty-player {
  display: grid;
  height: 100%;
  place-items: center;
  align-content: center;
  gap: 16px;
  color: #f4f4f5;
  text-align: center;
  padding: 24px;
}

.empty-player span {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
}

.empty-player p {
  margin: 0;
  max-width: 32rem;
  color: #d4d4d8;
}

.video-info {
  padding: 18px 2px 0;
}

.video-info h2 {
  margin: 0 0 8px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.12;
}

.uploader-name {
  margin: -2px 0 8px;
  color: #e11d48;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
}

.meta {
  color: var(--muted);
  font-size: 14px;
}

.description {
  max-width: 72ch;
  color: #3f3f46;
  line-height: 1.6;
  white-space: pre-wrap;
}

.soundcloud-tracklist {
  display: grid;
  gap: 1px;
  width: min(760px, 100%);
  margin-top: 24px;
  border-top: 1px solid var(--line);
}

.soundcloud-track {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: #27272a;
  text-align: left;
  cursor: pointer;
}

.soundcloud-track:hover,
.soundcloud-track.active {
  color: var(--accent-dark);
  background: #fff;
}

.soundcloud-track span:first-child {
  color: var(--muted);
  font-size: 13px;
}

.soundcloud-track span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.media-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.media-tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.media-tab.active {
  background: #18181b;
  color: #fff;
}

.media-panel {
  display: none;
  gap: 12px;
}

.media-panel.active {
  display: grid;
}

.upload-panel,
.library {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.upload-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.panel-heading h1,
.library-heading h2 {
  margin: 0;
  font-size: 20px;
}

.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #27272a;
  font-size: 14px;
  font-weight: 700;
}

input[type="text"],
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.file-drop {
  min-height: 66px;
  place-items: center;
  border: 1px dashed #a1a1aa;
  border-radius: 8px;
  color: #3f3f46;
  text-align: center;
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.primary-action {
  width: 100%;
  background: var(--accent);
  color: #fff;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  background: #18181b;
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.secondary-action:disabled {
  cursor: progress;
  opacity: 0.7;
}

.primary-action:disabled {
  cursor: progress;
  opacity: 0.72;
}

.status {
  min-height: 20px;
  color: var(--muted);
  font-size: 14px;
}

.status.error {
  color: var(--accent-dark);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-shell {
  display: grid;
  width: min(420px, 100%);
}

.login-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  margin-bottom: 4px;
}

.login-mode-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.login-mode-toggle:hover {
  background: #f3f4f6;
}

.upload-page {
  display: grid;
  gap: 14px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 4vw, 40px);
}

.upload-tabs {
  width: min(460px, 100%);
}

.upload-page-panel {
  padding: clamp(18px, 4vw, 28px);
}

.upload-drop {
  min-height: 112px;
}

.cover-drop {
  min-height: 78px;
}

.cover-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 10px;
  align-items: center;
}

.audio-upload-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid #d9d9d9;
  background: #f4f4f4;
  border-radius: 8px;
}

.audio-mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6b7280;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.audio-mode-button.active {
  background: #19191d;
  color: #fff;
}

.cover-preview {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #18181b;
}

.library {
  overflow: hidden;
}

.library-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.library-heading span {
  color: var(--muted);
  font-size: 13px;
}

.video-list {
  display: grid;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

.album-list {
  display: grid;
  gap: 10px;
  padding: 10px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

.empty-list {
  padding: 18px;
  color: var(--muted);
  font-size: 14px;
}

.empty-list p {
  margin: 0;
}

.video-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: inherit;
  text-align: left;
}

.video-card.active {
  background: #fafafa;
}

.video-card:hover {
  background: #fafafa;
}

.video-play {
  display: contents;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.thumb {
  position: relative;
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: #18181b;
  color: #fff;
}

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

.thumb-play {
  position: absolute;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: rgb(0 0 0 / 65%);
  color: #fff;
  font-size: 12px;
}

.video-card h3 {
  margin: 0 0 7px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 15px;
  line-height: 1.25;
}

.video-card .video-uploader {
  margin: 0 0 3px;
  color: #e11d48;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.video-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.video-actions {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  margin-top: 6px;
}

.download-button,
.delete-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  min-height: 32px;
  background: #f3f4f6;
  color: #52525b;
  border: 0;
  border-radius: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.download-button:hover,
.delete-button:hover {
  background: #e8e9ec;
  color: var(--accent-dark);
}

.album-card {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.album-card.active,
.album-card:hover {
  background: #fafafa;
}

.album-summary {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 24px;
  gap: 10px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  padding-right: 32px;
}

.album-share {
  position: absolute;
  top: 15px;
  right: 34px;
  z-index: 1;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--muted);
  cursor: pointer;
}

.album-share:hover {
  background: #e5e7eb;
  color: var(--ink);
}

.album-share img,
.album-chevron img {
  display: block;
  width: 16px;
  height: 16px;
}

.album-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #18181b;
  color: #fff;
  font-size: 24px;
}

.album-card h3 {
  margin: 2px 0 4px;
  font-size: 15px;
  line-height: 1.25;
}

.album-copy {
  min-width: 0;
}

.album-artist {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.album-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.album-chevron {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  transition: transform 160ms ease;
}

.album-card.open .album-chevron {
  transform: rotate(180deg);
}

.track-list {
  display: none;
  gap: 2px;
}

.album-delete {
  display: none;
}

.album-card.open .track-list {
  display: grid;
}

.album-card.open .album-delete {
  display: inline-flex;
}

.album-card.open {
  padding-bottom: 12px;
}

.track-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #3f3f46;
  text-align: left;
  cursor: pointer;
}

.track-button:hover,
.track-button.active {
  background: #f3f4f6;
  color: var(--accent-dark);
}

.track-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-delete {
  grid-column: auto;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .video-list {
    max-height: none;
  }

  .album-list {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas:
      "brand actions"
      "search search";
    gap: 10px;
    padding: 10px 14px;
  }

  .brand {
    grid-area: brand;
  }

  .site-search {
    grid-area: search;
  }

  .topbar-actions {
    grid-area: actions;
  }

  .brand span:last-child {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .app-shell {
    padding: 14px;
  }

  .upload-toggle,
  .logout-button,
  .account-button,
  .account-create-link,
  .login-link {
    padding: 0 10px;
    font-size: 13px;
  }

  .video-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .audio-player {
    grid-template-columns: 1fr;
    align-content: center;
    min-height: 420px;
  }

  .album-art {
    width: 96px;
    font-size: 42px;
  }

  .waveform {
    height: 62px;
    gap: 2px;
  }

  .soundcloud-track {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .audio-controls-row {
    grid-template-columns: 1fr;
  }
}
