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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: #1a1a1a;
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    width: 340px;
}

.login-box h1 {
    font-size: 28px;
    margin-bottom: 8px;
    color: #ff4444;
}

.login-box p {
    color: #888;
    margin-bottom: 24px;
    font-size: 14px;
}

#pin-input {
    width: 100%;
    padding: 14px;
    font-size: 24px;
    text-align: center;
    letter-spacing: 12px;
    background: #0f0f0f;
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    outline: none;
    margin-bottom: 16px;
}

#pin-input:focus {
    border-color: #ff4444;
}

#login-btn {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: #ff4444;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

#login-btn:hover {
    background: #e03333;
}

.error-msg {
    color: #ff6666;
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
}

/* App */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
}

header h1 {
    font-size: 20px;
    color: #ff4444;
}

.logout-btn {
    background: none;
    border: 1px solid #444;
    color: #aaa;
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.logout-btn:hover {
    border-color: #ff4444;
    color: #ff4444;
}

/* Download area */
.download-area {
    max-width: 700px;
    margin: 32px auto;
    padding: 0 16px;
}

.url-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.url-card.collapsing {
    max-height: 0;
    padding: 0;
    margin: 0;
    border-width: 0;
    opacity: 0;
}

.url-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.url-input {
    flex: 1;
    padding: 12px 14px;
    background: #0f0f0f;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.url-input:focus {
    border-color: #ff4444;
}

.url-input:disabled {
    opacity: 0.6;
}

.url-status {
    margin-top: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #444;
    border-top-color: #ff4444;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.status-text {
    color: #aaa;
}

.status-title {
    color: #6ab0ff;
    font-weight: 500;
}

.status-error {
    color: #ff6666;
}

.retry-btn {
    background: #333;
    border: none;
    color: #ff6666;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.retry-btn:hover {
    background: #444;
}

/* Completed panel */
.completed-panel {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 320px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    z-index: 100;
    max-height: 400px;
    display: flex;
    flex-direction: column;
}

.completed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.toggle-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
}

.completed-list {
    overflow-y: auto;
    max-height: 340px;
}

.completed-list.collapsed {
    display: none;
}

.completed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    transition: background 0.2s;
}

.completed-item:hover {
    background: #222;
}

.check-icon {
    color: #4caf50;
    font-size: 18px;
    flex-shrink: 0;
}

.completed-title {
    font-size: 13px;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.empty-completed {
    padding: 20px;
    text-align: center;
    color: #555;
    font-size: 13px;
}
