:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --success-color: #22c55e;
    --danger-color: #ef4444;

    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: 0.3s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 24px 16px 48px;
}

.container {
    max-width: 640px;
    margin: 0 auto;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: 24px;
}

.app-header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.app-header h1 i {
    -webkit-text-fill-color: var(--primary-color);
}

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

/* Card / views */
.card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
    padding: 28px;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.view.hidden { display: none; }

.card h2 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.center { text-align: center; }
.muted { color: var(--text-secondary); }
.small { font-size: 0.85rem; }

/* Steps list */
.steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-secondary);
}

.step-num {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--gradient-1);
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.steps strong { color: var(--text-primary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.85rem 1.6rem;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-block { width: 100%; }

.btn-primary {
    background: var(--gradient-1);
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    padding: 0.6rem 1.1rem;
}

.btn-secondary:hover { background: var(--gray-50); }

.btn-secondary.copied {
    background: var(--success-color);
    border-color: var(--success-color);
    color: var(--white);
}

.btn-ghost {
    background: transparent;
    color: var(--primary-color);
    border: 2px dashed var(--gray-200);
    margin-bottom: 18px;
}

.btn-ghost:hover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.04);
}

/* Inputs */
.field-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 18px 0 8px;
}

.text-input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.85);
    transition: all var(--transition);
}

.text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Spoiler rows */
.spoiler-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.spoiler-row .text-input { flex: 1; }

.spoiler-remove {
    flex: 0 0 40px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    color: var(--text-light);
    cursor: pointer;
    transition: all var(--transition);
}

.spoiler-remove:hover {
    background: #fee2e2;
    color: var(--danger-color);
}

/* Friend link box */
.friend-link {
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 22px;
}

.friend-link-head {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.friend-link-row {
    display: flex;
    gap: 8px;
}

.friend-link-row input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--white);
    color: var(--text-secondary);
}

.friend-link .muted { margin-top: 8px; }

/* Disclaimers */
.disclaimer {
    margin-top: 18px;
    font-size: 0.82rem;
    color: var(--text-light);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    line-height: 1.5;
}

.disclaimer i { margin-top: 2px; }

.error-text {
    color: var(--danger-color);
    font-size: 0.9rem;
    margin: 12px 0;
}

.hidden { display: none; }

/* Result list */
.result-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 10px;
}

.result-item i {
    color: var(--success-color);
    margin-top: 3px;
}

.result-empty {
    text-align: center;
    padding: 16px 0 8px;
}

.result-empty .big-icon {
    font-size: 2.4rem;
    color: var(--text-light);
    margin-bottom: 12px;
}

.result-count {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* "Friend edited" banner on the result view */
.updated-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-hover);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    animation: fadeInUp 0.4s ease;
}

/* Spinner */
.spinner {
    width: 44px;
    height: 44px;
    margin: 8px auto 18px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.error-icon {
    text-align: center;
    font-size: 2.6rem;
    color: var(--danger-color);
    margin-bottom: 8px;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 28px;
}

.app-footer a {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color var(--transition);
}

.app-footer a:hover { color: var(--primary-color); }

@media (max-width: 480px) {
    .card { padding: 20px; }
    .app-header h1 { font-size: 1.6rem; }
}
