:root {
    --bg: #0f0f23;
    --card: #1a1a35;
    --card-hover: #222245;
    --border: #2a2a4a;
    --text: #e8e8f0;
    --text-dim: #8888aa;
    --accent: #6c5ce7;
    --accent-glow: rgba(108, 92, 231, 0.3);
    --green: #00b894;
    --red: #ff6b6b;
    --gold: #ffd93d;
    --orange: #fdcb6e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Vazirmatn', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 80px;
}

/* ===== Header ===== */
header {
    text-align: center;
    padding: 24px 0 20px;
}

.logo {
    font-size: 2.5em;
    margin-bottom: 8px;
    filter: drop-shadow(0 0 20px var(--accent-glow));
}

header h1 {
    font-size: 1.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-dim);
    font-size: 0.85em;
    margin-top: 4px;
}

/* ===== Input ===== */
.input-wrapper {
    display: flex;
    gap: 8px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 6px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#url-input {
    flex: 1;
    padding: 12px 14px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 0.9em;
    direction: ltr;
    text-align: left;
    outline: none;
}

#url-input::placeholder {
    color: var(--text-dim);
    direction: ltr;
}

#submit-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: #fff;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

#submit-btn:active { transform: scale(0.95); }
#submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

#submit-status {
    margin-top: 10px;
    padding: 0;
    font-size: 0.85em;
    text-align: center;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s;
}

#submit-status.show {
    padding: 10px 14px;
    border-radius: 10px;
    max-height: 100px;
}

#submit-status.success {
    background: rgba(0, 184, 148, 0.15);
    color: var(--green);
    border: 1px solid rgba(0, 184, 148, 0.3);
}

#submit-status.error {
    background: rgba(255, 107, 107, 0.15);
    color: var(--red);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

#submit-status.loading {
    background: rgba(108, 92, 231, 0.15);
    color: var(--accent);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

/* ===== Queue ===== */
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--orange);
    margin-bottom: 10px;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--card);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    font-size: 0.85em;
    color: var(--text-dim);
}

.queue-item .spinner { flex-shrink: 0; }

.queue-item .url {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    direction: ltr;
    text-align: left;
}

/* ===== Video Cards ===== */
.card {
    background: var(--card);
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
}

.card:active { transform: scale(0.98); }
.card:hover { background: var(--card-hover); border-color: var(--accent); }

.card.unread { border-right: 3px solid var(--green); }
.card.failed { border: 1px solid var(--red); background: rgba(255, 107, 107, 0.05); }

.card-body {
    display: flex;
    gap: 12px;
    padding: 14px;
}

.card-thumb {
    width: 110px;
    min-width: 110px;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 10px;
    background: var(--border);
}

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

.card-title {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-stars {
    color: var(--gold);
    font-size: 0.85em;
    letter-spacing: 1px;
}

.card-reason {
    font-size: 0.75em;
    color: var(--text-dim);
    max-width: 55%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Detail View ===== */
.detail-header {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.detail-header h1 {
    font-size: 1.1em;
    margin-top: 10px;
    line-height: 1.5;
}

#back-btn {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85em;
    transition: background 0.2s;
}

#back-btn:active { background: var(--card-hover); }

.rating-box {
    background: linear-gradient(135deg, var(--card), var(--card-hover));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin: 16px 0;
}

.rating-stars {
    font-size: 2em;
    margin-bottom: 8px;
}

.rating-reason {
    color: var(--text-dim);
    font-size: 0.9em;
    line-height: 1.6;
}

.content-section {
    margin: 20px 0;
}

.content-section h3 {
    color: var(--accent);
    font-size: 1em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.content-section .body {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    line-height: 1.9;
    font-size: 0.9em;
    color: var(--text);
    white-space: pre-wrap;
}

.read-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    font-size: 0.85em;
    color: var(--text-dim);
    cursor: pointer;
}

.read-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.yt-link {
    display: block;
    text-align: center;
    padding: 16px;
    margin-top: 16px;
}

.yt-link a {
    color: var(--red);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

/* ===== Empty State ===== */
#empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 3em;
    margin-bottom: 12px;
    opacity: 0.5;
}

#empty-state p { color: var(--text-dim); font-size: 1em; }
#empty-state .hint { font-size: 0.85em; margin-top: 4px; opacity: 0.6; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
