:root {
  --accent: #6366f1;
  --accent-soft: #eef2ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --page: #f8fafc;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(99, 102, 241, 0.16), transparent 34rem),
    var(--page);
  font-family: Outfit, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.lock-button {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.68);
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.lock-button svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
}

.lock-button:hover {
  color: var(--accent);
  background: #ffffff;
  transform: translateY(-1px);
}

.login-dialog {
  width: min(calc(100% - 28px), 420px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.login-dialog::backdrop {
  background: rgba(15, 23, 42, 0.28);
}

.login-dialog form {
  margin: 0;
}

.dialog-status {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.shell {
  width: min(100%, 960px);
  margin: 0 auto;
  padding: 72px 20px;
}

.shell.is-loading {
  opacity: 0;
}

.intro {
  max-width: 640px;
  margin: 0 auto 28px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  margin: 0 0 14px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--accent);
  font-size: clamp(44px, 10vw, 76px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 0.95;
}

.lede {
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.player-card {
  width: min(100%, 480px);
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

.track-meta {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 8px 8px 18px;
}

.art {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  color: #ffffff;
  background: linear-gradient(135deg, #6366f1, #111827);
  box-shadow: 0 12px 28px rgba(99, 102, 241, 0.28);
}

.art span {
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.92;
  transform-origin: center bottom;
}

.art span:nth-child(2) {
  height: 30px;
}

.art span:nth-child(3) {
  height: 22px;
}

.is-playing .art span {
  animation: bars 0.72s ease-in-out infinite;
}

.is-playing .art span:nth-child(2) {
  animation-delay: 0.12s;
}

.is-playing .art span:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes bars {
  0%,
  100% {
    transform: scaleY(0.56);
  }
  50% {
    transform: scaleY(1);
  }
}

.label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  overflow: hidden;
  margin: 0;
  color: var(--accent);
  font-size: 21px;
  font-weight: 800;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#track-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.timeline {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
  padding: 0 8px;
}

.timeline span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#current-time {
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 0 18px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition:
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.icon-button.primary {
  width: 52px;
  height: 52px;
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 12px 24px rgba(99, 102, 241, 0.28);
}

.icon-button.secondary {
  width: 36px;
  height: 36px;
  color: #94a3b8;
  background: transparent;
}

.icon-button:hover {
  transform: translateY(-1px);
}

.icon-button.primary:hover {
  background: #4f46e5;
}

.icon-button.secondary:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.playlist {
  display: grid;
  gap: 5px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.track-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border-radius: 10px;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.track-item:hover {
  background: #f8fafc;
}

.track-item.is-active {
  background: var(--accent-soft);
}

.track-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 0 8px 10px;
  border: 0;
  border-radius: 10px;
  color: #475569;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color 160ms ease;
}

.track-item:hover .track-button,
.track-item:hover .download-button {
  color: var(--accent);
}

.track-item.is-active .track-button {
  color: var(--accent);
}

.track-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-index {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-right: 4px;
  border-radius: 9px;
  color: #94a3b8;
  text-decoration: none;
  transition:
    color 160ms ease,
    background 160ms ease;
}

.download-button:hover {
  background: #ffffff;
}

.download-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.admin-shell {
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 48px 20px;
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.admin-header h1 {
  font-size: clamp(40px, 8vw, 64px);
}

.text-link {
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.admin-panel {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 44px rgba(15, 23, 42, 0.08);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.token-row,
.admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.token-row input,
.edit-row input[type="text"],
.copy-fields input,
.copy-fields textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
}

.token-row input {
  height: 44px;
  padding: 0 12px;
}

.admin-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.admin-button,
.small-button {
  border: 0;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
  cursor: pointer;
  font-weight: 800;
}

.admin-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  text-decoration: none;
}

.admin-button.primary {
  color: #ffffff;
  background: var(--accent);
}

.back-link {
  white-space: nowrap;
}

.admin-button:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

.track-editor {
  display: grid;
  gap: 8px;
}

.copy-fields {
  display: grid;
  gap: 14px;
}

.copy-fields label {
  display: grid;
  gap: 8px;
}

.copy-fields input,
.copy-fields textarea {
  padding: 10px 12px;
  font-weight: 700;
}

.copy-fields textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.45;
}

.edit-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid #eef2f7;
  border-radius: 12px;
  background: #ffffff;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.edit-row.is-dragging {
  opacity: 0.44;
}

.edit-row.is-drop-target {
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.edit-row.is-hidden {
  opacity: 0.56;
}

.drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  color: #94a3b8;
  background: transparent;
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.drag-handle svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.drag-handle:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

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

.edit-row input[type="text"] {
  height: 40px;
  padding: 0 10px;
  font-weight: 800;
}

.edit-row p {
  overflow: hidden;
  margin: 6px 0 0;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.small-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.hide-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 560px) {
  .shell {
    padding: 44px 14px;
  }

  .player-card {
    border-radius: 18px;
    padding: 14px;
  }

  .track-meta {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
  }

  .art {
    width: 58px;
    height: 58px;
    border-radius: 16px;
  }

  .admin-shell {
    padding: 30px 12px;
  }

  .admin-header,
  .token-row,
  .admin-toolbar,
  .edit-row,
  .edit-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-header,
  .edit-row {
    display: grid;
  }

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

  .edit-actions {
    display: flex;
  }

  .hide-toggle {
    grid-column: auto;
  }
}
