:root {
    color-scheme: light dark;
    --bg: #f4f5f7;
    --surface: #ffffff;
    --fg: #16181d;
    --muted: #6b7280;
    --accent: #4f6d7a;
    --accent-hover: #3d5560;
    --border: #e2e5ea;
    --shadow: 0 1px 2px rgba(16, 20, 30, 0.04), 0 8px 24px rgba(16, 20, 30, 0.06);
    --radius: 10px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14161a;
        --surface: #1d2025;
        --fg: #e9eaec;
        --muted: #9aa1ac;
        --accent: #7ea2b0;
        --accent-hover: #93b3bf;
        --border: #2c3036;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    }
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, "Segoe UI", system-ui, sans-serif;
    background: var(--bg);
    color: var(--fg);
    margin: 0;
    padding: 2.5rem 1.5rem 4rem;
    max-width: 900px;
    margin-inline: auto;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

/* --- Layout sections as cards --------------------------------------- */

header.player-header,
header.dev-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

header.dev-header span {
    color: var(--muted);
    font-size: 0.9rem;
}

.track-picker,
.waveform-panel,
.upload-panel,
.track-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.track-picker {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.track-picker label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--muted);
}

/* --- Waveform / player ------------------------------------------------ */

#waveform {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: var(--bg);
    /* devtools/element-inspection friction is cosmetic only */
    user-select: none;
}

.transport {
    margin-bottom: 1rem;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

#selection-range {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 0.9rem;
}

#selection-price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent);
}

.selection-info #buy-button {
    margin-left: auto;
}

#purchase-status {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

#purchase-status a {
    color: var(--accent);
    font-weight: 600;
}

/* --- Buttons & inputs --------------------------------------------------- */

button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.05s ease;
}

button:hover:not(:disabled) {
    background: var(--accent-hover);
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="file"] {
    font: inherit;
    color: var(--fg);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
}

select:focus,
input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* --- Auth pages ------------------------------------------------------ */

body.auth-page {
    max-width: 420px;
}

.auth-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 4rem auto 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form h1 {
    margin-bottom: 0.25rem;
}

.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.auth-form input {
    font-weight: 400;
    color: var(--fg);
}

.auth-form button {
    margin-top: 0.5rem;
}

.error {
    color: #e05555;
    font-size: 0.9rem;
    margin: 0;
}

/* --- Dev portal upload & tracks --------------------------------------- */

.upload-panel form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 420px;
}

.upload-panel label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
}

.upload-panel button {
    align-self: flex-start;
}

#upload-status {
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.track-list table {
    width: 100%;
    border-collapse: collapse;
}

.track-list th {
    text-align: left;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    font-weight: 600;
    padding: 0 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.track-list td {
    text-align: left;
    padding: 0.65rem 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.track-list tr:last-child td {
    border-bottom: none;
}
