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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.container {
    width: 100%;
    max-width: 820px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2.5rem;
}

h1 {
    font-size: 2.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, #6c63ff, #48cfad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.tagline {
    margin-top: 0.4rem;
    color: #888;
    font-size: 1rem;
}

/* Labels */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.5rem;
}

/* Input textarea */
.input-section {
    margin-bottom: 1.25rem;
}

textarea {
    width: 100%;
    min-height: 220px;
    padding: 1rem 1.15rem;
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 10px;
    color: #e0e0e0;
    font-size: 1rem;
    line-height: 1.65;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

textarea:focus {
    outline: none;
    border-color: #6c63ff;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.15);
}

textarea::placeholder {
    color: #555;
}

/* Controls row */
.controls {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
}

.buttons {
    display: flex;
    gap: 0.75rem;
    margin-left: auto;
}

/* Buttons */
.btn {
    padding: 0.7rem 1.6rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.2s, background 0.2s;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #6c63ff, #5a52e0);
    color: #fff;
    box-shadow: 0 4px 14px rgba(108, 99, 255, 0.35);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7b73ff, #6c63ff);
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.45);
}

.btn-secondary {
    background: #1a1a2e;
    color: #48cfad;
    border: 1px solid #2a2a40;
}

.btn-secondary:hover {
    background: #222240;
    border-color: #48cfad;
}

.btn.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
    animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.4; }
}

/* Output */
.output-section {
    margin-top: 0.5rem;
}

.output-box {
    width: 100%;
    min-height: 180px;
    padding: 1rem 1.15rem;
    background: #1a1a2e;
    border: 1px solid #2a2a40;
    border-radius: 10px;
    font-size: 1rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.placeholder-text {
    color: #555;
    font-style: italic;
}

/* Spinner */
.spinner-wrap {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1.5rem 0;
}

.spinner {
    width: 22px;
    height: 22px;
    border: 3px solid #2a2a40;
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.spinner-text {
    color: #888;
    font-size: 0.95rem;
}

/* Copy button */
.output-box {
    position: relative;
}

.copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.3rem 0.75rem;
    background: #2a2a40;
    border: 1px solid #3a3a55;
    border-radius: 5px;
    color: #aaa;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 1;
}

.copy-btn:hover {
    background: #3a3a55;
    color: #e0e0e0;
}

/* Result text */
.result-wrap {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.result-text {
    line-height: 1.7;
}

/* Error message */
.error-msg {
    color: #ff6b6b;
    font-style: italic;
    padding: 0.5rem 0;
}

/* Plagiarism results */
.plag-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #2a2a40;
}

.plag-score {
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
}

.plag-score.low {
    background: rgba(72, 207, 173, 0.15);
    color: #48cfad;
}

.plag-score.medium {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
}

.plag-score.high {
    background: rgba(255, 107, 107, 0.15);
    color: #ff6b6b;
}

.plag-detail {
    color: #888;
    font-size: 0.9rem;
}

.plag-body {
    line-height: 1.85;
    font-size: 1rem;
}

.plag-flagged {
    background: rgba(255, 107, 107, 0.15);
    color: #ff9a9a;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    border-bottom: 2px solid #ff6b6b;
}

.plag-clean {
    color: #c0c0c0;
}

.plag-link {
    color: #6c63ff;
    font-size: 0.8rem;
    text-decoration: none;
}

.plag-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 560px) {
    h1 {
        font-size: 1.8rem;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .buttons {
        margin-left: 0;
    }

    .btn {
        flex: 1;
        text-align: center;
    }
}
