:root {
    --bg: #f5f5f7;
    --surface: #ffffff;
    --text: #121212;
    --muted: #6b6b6f;
    --border: #e4e4e7;
    --primary: #11a2d7;
    --secondary: #e775a6;
    --brand-accent: #f7dc6f;
    --danger: #c0392b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f0f10;
        --surface: #1a1a1c;
        --text: #f2f2f3;
        --muted: #9a9a9e;
        --border: #2c2c2f;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    max-width: 640px;
    margin: 0 auto;
    padding: 48px 20px 32px;
}

.hero {
    text-align: center;
    margin-bottom: 24px;
}

.hero h1 {
    font-size: 2rem;
    margin: 0 0 8px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    color: var(--muted);
    margin: 0;
}

.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}

.mode-tab {
    padding: 8px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

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

.mode-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.url-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#tiktok-url {
    flex: 1 1 280px;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
}

#tiktok-url:focus {
    outline: 2px solid var(--secondary);
    outline-offset: 1px;
}

#submit-btn {
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

#submit-btn:hover {
    opacity: 0.9;
}

#submit-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

.status {
    min-height: 1.4em;
    margin: 16px 0 0;
    font-size: 0.95rem;
}

.status[data-tone="error"] {
    color: var(--danger);
}

.status[data-tone="loading"] {
    color: var(--muted);
}

.result {
    margin-top: 24px;
    display: flex;
    gap: 20px;
    padding: 20px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.result[hidden] {
    display: none;
}

.result-thumb {
    width: 120px;
    height: 160px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    background: var(--bg);
}

.result-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.result-title {
    font-size: 1rem;
    margin: 0 0 6px;
    overflow-wrap: anywhere;
}

.result-meta {
    color: var(--muted);
    margin: 0 0 16px;
    font-size: 0.9rem;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.result-actions[hidden] {
    display: none;
}

.btn {
    display: inline-block;
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn[hidden] {
    display: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.audio-unavailable {
    color: var(--muted);
    font-size: 0.85rem;
    margin: 0;
}

.seo-copy {
    margin-top: 40px;
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

.footer {
    margin-top: 24px;
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
}

@media (max-width: 460px) {
    .result {
        flex-direction: column;
    }

    .result-thumb {
        width: 100%;
        height: 220px;
    }
}
