:root {
    color-scheme: dark;
    --bg: #0b0b0d;
    --panel: #141418;
    --panel-2: #1a1a20;
    --line: #2a2a31;
    --text: #f5f4f2;
    --muted: #a6a3ad;
    --accent: #ff4f87;
    --accent-2: #ff8d55;
    --danger: #ff6a6a;
    --success: #66d98f;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
        "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 79, 135, 0.12), transparent 34rem),
        radial-gradient(circle at top right, rgba(255, 141, 85, 0.08), transparent 30rem),
        var(--bg);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

a {
    color: inherit;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding-bottom: 64px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 74px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
    box-shadow: 0 8px 30px rgba(255, 79, 135, 0.25);
}

.brand-word {
    font-size: 1.1rem;
}

.identity-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.9rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(102, 217, 143, 0.1);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
    gap: 48px;
    align-items: center;
    padding: 64px 0 42px;
}

.eyebrow,
.card-kicker {
    margin: 0 0 8px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.16em;
}

.hero h1 {
    margin: 0;
    max-width: 720px;
    font-size: clamp(3rem, 8vw, 6.6rem);
    line-height: 0.92;
    letter-spacing: -0.07em;
}

.hero h1 em {
    font-style: normal;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-copy {
    max-width: 620px;
    margin: 22px 0 0;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.65;
}

.account-card,
.add-panel,
.recommendation-panel,
.repertoire-panel {
    border: 1px solid var(--line);
    background: rgba(20, 20, 24, 0.92);
    box-shadow: var(--shadow);
}

.account-card {
    border-radius: 24px;
    padding: 24px;
}

.account-heading,
.dialog-header,
.section-heading,
.repertoire-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
}

.account-heading h2,
.section-heading h2,
.repertoire-header h2,
.dialog h2 {
    margin: 0;
    letter-spacing: -0.03em;
}

.account-copy {
    color: var(--muted);
    line-height: 1.55;
}

.account-email {
    font-weight: 700;
    word-break: break-word;
}

.cloud-chip,
.sync-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.sync-check {
    width: 34px;
    padding: 0;
    background: rgba(102, 217, 143, 0.14);
    color: var(--success);
}

.workspace {
    display: grid;
    gap: 24px;
}

.add-panel,
.recommendation-panel,
.repertoire-panel {
    border-radius: 28px;
    padding: 26px;
}

.recommendation-panel {
    border: 1px solid var(--line);
    background: rgba(20, 20, 24, 0.92);
    box-shadow: var(--shadow);
}

.recommendation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.recommendation-header h2 {
    margin: 0;
    letter-spacing: -0.03em;
}

.recommendation-copy,
.recommendation-status {
    color: var(--muted);
    line-height: 1.5;
}

.recommendation-copy {
    margin: 8px 0 0;
    max-width: 720px;
}

.recommendation-status {
    margin-top: 18px;
    font-size: 0.88rem;
}

.recommendation-list {
    display: block;
    max-width: 720px;
    margin-top: 16px;
}

.recommendation-card {
    display: grid;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    background: #111115;
}

.recommendation-title {
    margin: 0;
    font-size: 1rem;
}

.recommendation-artist {
    margin: 4px 0 0;
    color: var(--text);
    font-size: 0.9rem;
}

.recommendation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.mini-action {
    border: 1px solid var(--line);
    border-radius: 999px;
    min-height: 32px;
    padding: 0 10px;
    background: var(--panel-2);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 750;
}

.mini-action:hover,
.mini-action:focus-visible {
    border-color: rgba(255, 79, 135, 0.55);
    color: var(--text);
}

.add-song-form {
    display: grid;
    grid-template-columns: 1.3fr 1fr 190px auto;
    gap: 14px;
    align-items: end;
    margin-top: 20px;
}

.field,
.stack-form {
    display: grid;
    gap: 8px;
}

.field span,
.stack-form > label {
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

input,
select {
    width: 100%;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #101014;
    color: var(--text);
    padding: 0 13px;
    outline: none;
}

input:focus,
select:focus {
    border-color: rgba(255, 79, 135, 0.75);
    box-shadow: 0 0 0 3px rgba(255, 79, 135, 0.12);
}

.inline-field {
    display: flex;
    gap: 10px;
}

.inline-field input {
    flex: 1;
}

.button {
    min-height: 46px;
    border: 0;
    border-radius: 13px;
    padding: 0 16px;
    font-weight: 800;
}

.button.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: white;
}

.button.primary:hover {
    filter: brightness(1.06);
}

.button.ghost {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
}

.text-button,
.icon-button {
    border: 0;
    background: transparent;
    color: var(--muted);
}

.text-button {
    padding: 5px 0;
    font-weight: 700;
}

.text-button:hover {
    color: var(--text);
}

.text-button.danger:hover {
    color: var(--danger);
}

.text-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    font-size: 1.5rem;
}

.icon-button:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.otp-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.8rem;
}

.repertoire-header {
    align-items: center;
    margin-bottom: 20px;
}

.search-field {
    width: min(320px, 100%);
}

.bucket-tabs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.bucket-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #101014;
    color: var(--muted);
    padding: 0 14px;
    font-weight: 700;
}

.bucket-tab strong {
    display: grid;
    place-items: center;
    min-width: 25px;
    height: 25px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--text);
    font-size: 0.75rem;
}

.bucket-tab.active {
    border-color: rgba(255, 79, 135, 0.45);
    background: rgba(255, 79, 135, 0.1);
    color: var(--text);
}

.song-list {
    display: grid;
    gap: 10px;
}

.song-card {
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #111115;
    padding: 16px;
}

.song-main {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}

.song-text {
    min-width: 0;
}

.song-title {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.song-artist {
    margin: 4px 0 0;
    color: var(--muted);
}

.song-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 9px;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    background: var(--panel-2);
    color: var(--muted);
    padding: 0 9px;
    font-size: 0.7rem;
    font-weight: 700;
}

.meta-chip.matched {
    color: #f5b6ca;
}

.song-state-select {
    width: auto;
    min-width: 150px;
    min-height: 38px;
    font-size: 0.82rem;
}

.song-actions {
    display: flex;
    gap: 18px;
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.8rem;
}

.empty-state {
    display: grid;
    place-items: center;
    text-align: center;
    min-height: 280px;
    border: 1px dashed var(--line);
    border-radius: 18px;
    color: var(--muted);
    padding: 24px;
}

.empty-state h3 {
    margin: 10px 0 4px;
    color: var(--text);
}

.empty-state p {
    margin: 0;
}

.empty-icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: var(--panel-2);
    color: var(--accent);
    font-size: 1.5rem;
}

.dialog {
    width: min(560px, calc(100% - 28px));
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--panel);
    color: var(--text);
    padding: 22px;
    box-shadow: var(--shadow);
}

.dialog::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(5px);
}

.dialog form {
    display: grid;
    gap: 16px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.youtube-dialog {
    width: min(680px, calc(100% - 28px));
}

.youtube-candidates {
    display: grid;
    gap: 10px;
    margin-top: 20px;
}

.youtube-candidate {
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 14px;
    background: #111115;
}

.youtube-candidate-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.youtube-candidate a {
    color: #ff9fbe;
    text-decoration: none;
    font-weight: 700;
}

.feedback-row {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-top: 12px;
}

.feedback-row label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.76rem;
}

.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 8px;
    z-index: 20;
}

.toast {
    width: min(360px, calc(100vw - 36px));
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #18181d;
    color: var(--text);
    padding: 12px 14px;
    box-shadow: var(--shadow);
}

.toast.error {
    border-color: rgba(255, 106, 106, 0.45);
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        gap: 28px;
        padding-top: 44px;
    }

    .hero h1 {
        font-size: clamp(3.3rem, 14vw, 6rem);
    }

    .add-song-form {
        grid-template-columns: 1fr 1fr;
    }

    .add-button {
        align-self: end;
    }

    .bucket-tabs {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .app-shell {
        width: min(100% - 20px, 1180px);
    }

    .topbar {
        min-height: 64px;
    }

    .identity-summary {
        max-width: 52vw;
        justify-content: flex-end;
        text-align: right;
        font-size: 0.76rem;
    }

    .hero {
        padding-top: 34px;
    }

    .hero h1 {
        font-size: clamp(3.1rem, 18vw, 5rem);
    }

    .add-panel,
    .recommendation-panel,
    .repertoire-panel,
    .account-card {
        padding: 18px;
        border-radius: 20px;
    }

    .add-song-form {
        grid-template-columns: 1fr;
    }

    .recommendation-header {
        flex-direction: column;
    }

    .recommendation-header .button {
        width: 100%;
    }


    .repertoire-header {
        align-items: stretch;
        flex-direction: column;
    }

    .search-field {
        width: 100%;
    }

    .bucket-tabs {
        grid-template-columns: 1fr;
    }

    .song-main {
        flex-direction: column;
    }

    .song-state-select {
        width: 100%;
    }

    .song-actions {
        justify-content: space-between;
    }

    .inline-field {
        flex-direction: column;
    }

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