@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

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

:root {
    --bg: #0f0f13;
    --card: #1a1a2e;
    --card-border: #2a2a3e;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent-1: #1877f2;
    --accent-2: #0d65d9;
    --accent-3: #0a4da8;
    --gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
    --radius: 12px;
    --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 800px; margin: 0 auto; padding: 0 16px; width: 100%; }

/* Header */
.site-header {
    border-bottom: 1px solid var(--card-border);
    padding: 16px 0;
    background: rgba(15, 15, 19, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 1.15rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    color: #fff;
}

nav { display: flex; gap: 20px; }

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

nav a:hover { color: var(--accent-1); }

/* Hero */
.hero {
    text-align: center;
    padding: 48px 16px 24px;
}

.hero h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 540px;
    margin: 0 auto;
}

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
}

.card h2 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Input Group */
.input-group {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.input-group input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 0;
}

.input-group input:focus {
    border-color: var(--accent-1);
}

.input-group input::placeholder {
    color: var(--text-muted);
    font-family: 'Inter', sans-serif;
}

.btn-icon {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: 48px;
    min-height: 48px;
}

.btn-icon:hover {
    color: var(--accent-1);
    border-color: var(--accent-1);
}

/* Options */
.options-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.option-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.option-group select {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    color: var(--text);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    min-height: 44px;
    transition: border-color 0.2s;
}

.option-group select:focus {
    border-color: var(--accent-1);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.1s;
    min-height: 48px;
    text-decoration: none;
}

.btn-primary:hover { opacity: 0.9; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-save { margin-top: 12px; }

/* Status */
.status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.status.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.status.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    color: var(--text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--card-border);
    border-top-color: var(--accent-1);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Result */
.result-card {
    margin-top: 20px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
}

.result-preview {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #000;
}

.result-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-info {
    padding: 16px;
}

.result-info h3 {
    font-size: 1rem;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.result-meta {
    display: flex;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

/* Picker */
.picker-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 12px;
    transition: border-color 0.2s;
}

.picker-item:hover {
    border-color: var(--accent-1);
}

.picker-item img {
    width: 100px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.picker-item-info {
    flex: 1;
    min-width: 0;
}

.picker-item-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.picker-item a {
    background: var(--gradient);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    min-height: 36px;
    display: flex;
    align-items: center;
}

/* How To */
.steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.step-num {
    width: 40px;
    height: 40px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.step h3 {
    font-size: 1rem;
    margin-bottom: 4px;
}

.step p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Features */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.feature {
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 20px;
    text-align: center;
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    background: rgba(24, 119, 242, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-1);
    font-weight: 700;
    font-size: 0.9rem;
}

.feature h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.feature p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Supported */
.supported-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.supported-list li {
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    position: relative;
    padding-left: 32px;
}

.supported-list li::before {
    content: '\2713';
    position: absolute;
    left: 12px;
    color: var(--accent-1);
    font-weight: 700;
}

/* FAQ */
details {
    border-bottom: 1px solid var(--card-border);
    padding: 16px 0;
}

details:last-child { border-bottom: none; }

summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 44px;
}

summary::after {
    content: '+';
    color: var(--accent-1);
    font-size: 1.3rem;
    font-weight: 400;
    transition: transform 0.2s;
}

details[open] summary::after {
    content: '-';
}

summary::-webkit-details-marker { display: none; }

details p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 8px;
    line-height: 1.7;
}

/* Ad Slots */
.ad-slot {
    min-height: 90px;
    background: var(--card);
    border: 1px dashed var(--card-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 20px auto;
}

/* Footer */
.site-footer {
    margin-top: auto;
    border-top: 1px solid var(--card-border);
    padding: 32px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent-1); }

.site-footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.disclaimer {
    font-size: 0.78rem !important;
    opacity: 0.6;
}

/* Preview Card */
.preview-card {
    margin-top: 16px;
    background: var(--bg);
    border: 1px solid var(--accent-1);
    border-radius: var(--radius);
    padding: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-icon {
    width: 40px;
    height: 40px;
    background: rgba(24, 119, 242, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-1);
    flex-shrink: 0;
}

.preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.preview-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.preview-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.preview-hint {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-left: 52px;
}

/* ============== RESPONSIVE ============== */

/* Small phones */
@media (max-width: 480px) {
    .hero { padding: 32px 12px 16px; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: 0.95rem; }

    .card { padding: 18px 14px; }

    .options-row { flex-direction: column; }

    .feature-grid { grid-template-columns: 1fr; }
    .supported-list { grid-template-columns: 1fr; }

    nav { gap: 12px; }
    nav a { font-size: 0.82rem; }

    .logo span:last-child { font-size: 1rem; }

    .picker-item { flex-direction: column; align-items: stretch; }
    .picker-item img { width: 100%; height: auto; aspect-ratio: 16/9; }

    .preview-hint { padding-left: 0; }
    .preview-badge { padding: 4px 8px; font-size: 0.75rem; }
}

/* Tablets */
@media (min-width: 481px) and (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }

    .card { padding: 24px 20px; }
}

/* Desktop */
@media (min-width: 769px) {
    .container { padding: 0 24px; }

    .card { padding: 32px; }

    .hero { padding: 56px 24px 28px; }
    .hero h1 { font-size: 2.4rem; }
}

@media (min-width: 1024px) {
    .container { max-width: 860px; }
}

/* Touch targets */
@media (pointer: coarse) {
    .btn-primary, .btn-icon, summary, .option-group select, nav a {
        min-height: 44px;
    }

    nav a { padding: 8px 4px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .spinner { animation: none; }
    * { transition-duration: 0.01ms !important; }
}