:root {
    --bg: #140f1f;
    --surface: #1f1833;
    --surface-2: #2a2145;
    --line: #3a2f5c;
    --text: #f3eefc;
    --muted: #a294c7;
    --pink: #ff5fa2;
    --cyan: #4be8e0;
    --yellow: #ffe066;
    --blue: #1c6dd0;
    --step: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 15% 0%, #241a3d 0%, transparent 55%),
        radial-gradient(circle at 90% 20%, #1d2b3f 0%, transparent 45%),
        var(--bg);
    color: var(--text);
    font-family: 'Space Grotesk', system-ui, sans-serif;
    min-height: 100vh;
    padding-bottom: 80px;
}

h1,
h2,
h3,
.pixel-font {
    font-family: 'Press Start 2P', monospace;
}

::selection {
    background: var(--pink);
    color: var(--bg);
}

a {
    color: var(--cyan);
}

/* --- pixel stepped corners, used on cards/buttons/chips --- */
.pixel-corners {
    clip-path: polygon(0px 8px, 4px 8px, 4px 4px, 8px 4px, 8px 0px,
            calc(100% - 8px) 0px, calc(100% - 8px) 4px, calc(100% - 4px) 4px, calc(100% - 4px) 8px, 100% 8px,
            100% calc(100% - 8px), calc(100% - 4px) calc(100% - 8px), calc(100% - 4px) calc(100% - 4px), calc(100% - 8px) calc(100% - 4px), calc(100% - 8px) 100%,
            8px 100%, 8px calc(100% - 4px), 4px calc(100% - 4px), 4px calc(100% - 8px), 0px calc(100% - 8px));
}

/* --- header / logo --- */
header {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 20px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    flex: none;
    background: var(--cyan);
    position: relative;
    clip-path: polygon(0 0, 76% 0, 100% 24%, 100% 100%, 0 100%);
}

.logo-icon::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 7px;
    width: 18px;
    height: 12px;
    background: var(--bg);
}

.logo-icon::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 7px;
    width: 12px;
    height: 12px;
    background: var(--pink);
}

.wordmark h1 {
    font-size: min(3vw, 20px);
    line-height: 1.6;
    margin: 0;
    color: var(--yellow);
}

.wordmark p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 0.85rem;
}

#keyWarning {
    max-width: 960px;
    margin: 0 auto 20px;
    padding: 12px 16px;
    background: #402344;
    border: 1px dashed var(--pink);
    color: var(--yellow);
    font-size: 0.85rem;
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}

/* --- filters --- */

.feature-button {
    padding: 0px;
    background: transparent;
    color: white;
    font-size: 11px;
    font-weight: 300;
    margin-left: 14px;
    width: -webkit-fill-available;
    text-align: left;
}

.feature-button:hover {
    text-decoration: underline;
    background-color: rgba(255, 255, 255, 0.097);
}

.filters {
    font-size: 12px;
    max-height: 40vh;
    margin-bottom: 10px;
    overflow-y: auto;
    font-weight: bold;
    column-count: 3;
}

.filters p {
    margin-bottom: 0px;
    color: var(--cyan);
}

.filters label {
    display: block;
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
}

select,
input[type=text],
input[type=password],
textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 10px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
}

select:disabled {
    opacity: 0.45;
}

.filters-actions {
    margin: 4px 0 24px;
}

button {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    cursor: pointer;
    border: none;
    padding: 10px 16px;
    background: var(--pink);
    color: var(--bg);
}

button.ghost {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
}

button.small {
    padding: 6px 10px;
    font-size: 0.8rem;
}

button:hover {
    filter: brightness(1.12);
}

/* --- contribution list --- */

#currentDisplay {
    font-size: 32px;
    margin-top: 40px;
}

#contributionsList {
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 14px;
}

.contrib-row {
    background: var(--surface);
    border: 1px solid var(--line);
}

.contrib-row:hover {
    border: 1px solid white;
}

.row-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    cursor: pointer;
    flex-wrap: wrap;
}

.tag {
    padding: 4px 8px;
    color: var(--bg);
}

.tag.feature {
    background: var(--yellow);
}

.tag.category {
    background: var(--cyan);
}

.song-title {
    font-weight: 700;
    text-wrap: nowrap;
    overflow: hidden;
    flex: 1;
}

.artist-name {
    color: var(--muted);
}

.chevron {
    margin-left: auto;
    color: var(--muted);
}

.row-detail {
    padding: 14px;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
    color: var(--muted);
}

.row-detail p {
    margin: 8px 0;
}

.row-detail strong {
    color: var(--text);
}

#listStatus {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 10px 0;
}

/* --- floating new button --- */
#btnNewContribution {
    right: 24px;
    bottom: 24px;
    padding: 14px 18px;
    background: var(--pink);
    box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--yellow);
}

/* --- modal --- */
#modalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 7, 18, 0.8);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    overflow-y: auto;
    z-index: 20;
}

#modalOverlay.open {
    display: flex;
}

#modal {
    background: var(--surface);
    border: 1px solid var(--line);
    max-width: 560px;
    width: 100%;
    padding: 24px;
}

#modal h2 {
    font-size: 0.9rem;
    color: var(--pink);
    margin: 0 0 16px;
}

.field-block {
    margin-bottom: 18px;
}

.field-block>label {
    display: block;
    font-size: 0.75rem;
    color: var(--muted);
    margin-bottom: 8px;
}

#modalClose {
    float: right;
    background: none;
    color: var(--muted);
    font-size: 1rem;
    padding: 0 4px;
}

.song-search-row {
    display: flex;
    gap: 6px;
}

.song-search-row input {
    flex: 1;
}

#songResultsSelect {
    margin-top: 8px;
}

#formError {
    color: var(--pink);
    font-size: 0.8rem;
    min-height: 1em;
    margin-bottom: 10px;
}

@media (max-width: 700px) {
    .filters {
        grid-template-columns: 1fr 1fr;
    }

    .spotify-creds {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 460px) {
    .filters {
        grid-template-columns: 1fr;
    }
}




.contrib-play-wrap {
  position: relative;
  width: 60px;
  height: 60px;
  display: inline-block;
  margin: -12px 0px;
}

.contrib-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg); /* start progress at 12 o'clock */
}

.contrib-ring-bg,
.contrib-ring-progress {
  fill: none;
  stroke-width: 3;
}

.contrib-ring-bg {
  stroke: rgba(0, 0, 0, 0.1);
}

.contrib-ring-progress {
  stroke: #1db954; /* pick your color */
  stroke-linecap: round;
  stroke-dasharray: 163.36; /* 2 * PI * r (r=26) */
  stroke-dashoffset: 163.36; /* full offset = empty ring */
  transition: stroke-dashoffset 0.1s linear;
}

.contrib-play-btn {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.contrib-play-btn svg {
  width: 22px;
  height: 22px;
  fill: #333;
}




#iframe-container {
    display: flex;
    justify-content: center;
}





.card {
    max-width: 640px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 12px;
    padding: 20px 16px 14px;
}

.readout {
    text-align: center;
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.readout b {
    color: var(--ink);
}

.trim {
    position: relative;
    padding: 7px 0;
    user-select: none;
    -webkit-user-select: none;
}

/* The visible 40-second window. Everything inside is clipped. */
.viewport {
    position: relative;
    height: 30px;
    overflow: hidden;
    cursor: grab;
    touch-action: pan-y;
}

.viewport.dragging {
    cursor: grabbing;
}

/* The grey line = the whole video at the current zoom. It only slides left/right under the window. */
.bar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    overflow: hidden;
    background: var(--line);
    will-change: transform;
}

.tick {
    flex: 0 0 var(--tick-w);
    overflow: hidden;
    padding-left: 3px;
    border-left: 1px solid rgba(29, 39, 51, .3);
    font-size: 10px;
    line-height: 30px;
    color: #3b4856;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Dim everything outside the snippet, frame the snippet itself */
.shade {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
}

.sel {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
    border-top: 3px solid var(--blue);
    border-bottom: 3px solid var(--blue);
}

/* Start and end markers: vertical rectangles, taller than the line */
.marker {
    position: absolute;
    top: 0;
    width: 22px;
    height: 44px;
    padding: 0;
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 700 16px/1 system-ui, sans-serif;
    color: #fff;
    z-index: 2;
}

.marker.start {
    background: var(--blue);
    border-radius: 6px 0 0 6px;
    pointer-events: none;
}

.marker.end {
    background: var(--pink);
    border-radius: 0 6px 6px 0;
    cursor: grab;
    touch-action: none;
    box-shadow: 0 2px 0 #a8275a;
}

.marker.end.dragging {
    cursor: grabbing;
}

.marker.end::after {
    content: "";
    position: absolute;
    inset: -4px -12px -4px -8px;
}

/* bigger touch area */
.viewport:focus-visible,
.marker.end:focus-visible {
    outline: 3px solid #f0a020;
    outline-offset: 2px;
}
