:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a24;
    --accent: #6366f1;
    --accent-2: #ec4899;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #2d2d3a;
    --success: #10b981;
    --error: #ef4444;
    --spotify: #1db954;
    --apple: #fc3c44;
    --youtube: #ff0000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(0.75rem, 2.5vw, 2rem);
    padding-left: max(clamp(0.75rem, 2.5vw, 2rem), env(safe-area-inset-left, 0px));
    padding-right: max(clamp(0.75rem, 2.5vw, 2rem), env(safe-area-inset-right, 0px));
    background-image:
        radial-gradient(ellipse at top, rgba(99, 102, 241, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(236, 72, 153, 0.08) 0%, transparent 55%);
}

.container { width: 100%; max-width: 680px; margin-top: 3rem; }

/* Header */
header.site { text-align: center; margin-bottom: 2.5rem; }

.brand-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.brand-logo {
    width: 48px;
    height: 48px;
    filter: drop-shadow(0 4px 12px rgba(99,102,241,0.4));
}

.logo {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1.headline {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Input */
.input-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-wrapper { display: flex; gap: 0.75rem; }

input[type="text"] {
    flex: 1;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.2s ease;
}

input[type="text"]:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
input[type="text"]::placeholder { color: var(--text-muted); }

button {
    padding: 1rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

button:hover { transform: translateY(-2px); box-shadow: 0 8px 25px var(--accent-glow); }
button:active { transform: translateY(0); }
button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.hint { margin-top: 1rem; font-size: 0.875rem; color: var(--text-muted); }
.hint code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
}

/* Results */
.results { display: none; animation: fadeIn 0.3s ease; }
.results.visible { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.track-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    display: flex;
    gap: 1.25rem;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.track-artwork { width: 80px; height: 80px; border-radius: 8px; background: var(--bg-secondary); object-fit: cover; flex-shrink: 0; }
.track-details { flex: 1; min-width: 0; overflow: hidden; }
.track-details h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    overflow: hidden;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.track-details .artist {
    color: var(--text-secondary);
    font-size: 1rem;
    overflow: hidden;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}
.track-details .album {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    overflow: hidden;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.platform-links { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }

.platform-link {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto 16px;
    align-items: center;
    column-gap: 10px;
    padding: 12px 14px;
    min-height: 54px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text-primary);
    transition: background 0.2s ease;
}
.platform-link:last-child { border-bottom: none; }
.platform-link:hover { background: var(--bg-secondary); }

.platform-icon-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: block;
    flex-shrink: 0;
    overflow: hidden;
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    line-height: 0;
}

.platform-brand-icon {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    display: block;
    border-radius: 8px;
    object-fit: contain;
}

.platform-name {
    grid-column: 2;
    grid-row: 1;
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.confidence {
    grid-column: 3;
    grid-row: 1;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.14);
    color: #cbd5e1;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.confidence.high {
    background: rgba(16, 185, 129, 0.18);
    color: #6ee7b7;
}

.confidence.medium {
    background: rgba(99, 102, 241, 0.16);
    color: #c4b5fd;
}

.confidence.low {
    background: rgba(148, 163, 184, 0.12);
    color: #94a3b8;
}

.arrow {
    grid-column: 4;
    grid-row: 1;
    color: var(--text-muted);
    justify-self: end;
    line-height: 1;
}

.universal-link { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; margin-top: 1rem; }
.universal-link h3 { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 0.75rem; font-weight: 500; }
.link-box { display: flex; flex-direction: column; gap: 0.625rem; }
.link-box input {
    width: 100%; padding: 0.75rem 1rem; font-size: 0.875rem;
    font-family: 'Space Mono', monospace; background: var(--bg-secondary);
    border: 1px solid var(--border); border-radius: 8px; color: var(--text-primary); outline: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.link-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr));
    gap: 8px;
}

.link-actions .copy-btn,
.link-actions .copy-text-btn,
.link-actions .share-btn {
    width: 100%;
    min-height: var(--touch-min);
}
.copy-btn, .share-btn { flex: 1; padding: 0.75rem 1rem; font-size: 0.875rem; font-weight: 600; border-radius: 8px; }
.copy-btn { background: var(--bg-secondary); border: 1px solid var(--border); color: var(--text-primary); }
.copy-btn:hover { background: var(--border); transform: none; box-shadow: none; }
.copy-btn.copied { background: var(--success); border-color: var(--success); color: #fff; }
.share-btn { background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%); border: 1px solid transparent; color: #fff; }
.share-btn:hover { filter: brightness(1.08); transform: none; box-shadow: none; }
.share-hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.625rem; line-height: 1.4; }

.error-message { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3); border-radius: 12px; padding: 1rem 1.25rem; color: var(--error); display: none; }
.error-message.visible { display: block; }

.loading { display: none; text-align: center; padding: 2rem; color: var(--text-secondary); }
.loading.visible { display: block; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
.loading-text { transition: opacity 0.22s ease, transform 0.22s ease; font-size: 0.95rem; color: var(--text-secondary); }
.loading-text.fading { opacity: 0; transform: translateY(6px); visibility: hidden; }

.loading-copy {
    position: relative;
    height: 1.6em;
    overflow: hidden;
    margin: 0 auto;
    max-width: 340px;
}

.loading-copy .loading-text {
    position: absolute;
    left: 0;
    right: 0;
    margin: 0;
    min-height: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Content sections (SEO) */
.content { width: 100%; max-width: 680px; margin-top: 4rem; }
.content section { margin-bottom: 3rem; }
.content h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 1.25rem; letter-spacing: -0.01em; }

.steps { display: grid; gap: 1rem; }
.step { display: flex; gap: 1rem; align-items: flex-start; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.step-num {
    flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem;
}
.step h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.25rem; }
.step p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.5; }

.features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.feature { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; }
.feature h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; }
.feature p { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.5; }

.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 1.25rem; margin-bottom: 0.75rem; }
.faq-item h3 { font-size: 1.02rem; font-weight: 600; margin-bottom: 0.4rem; }
.faq-item p { color: var(--text-secondary); font-size: 0.95rem; line-height: 1.55; }

footer { margin-top: 2rem; padding-top: 3rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }

@media (max-width: 640px) {
    body {
        padding: max(0.75rem, env(safe-area-inset-top, 0px)) max(0.75rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
    }

    .container { margin-top: 2rem; }
    .logo { font-size: 2.2rem; }
    h1.headline { font-size: 1.6rem; }
    .input-wrapper { flex-direction: column; }
    button { width: 100%; }
    .track-info { flex-direction: column; text-align: center; }
    .features { grid-template-columns: 1fr; }
}
