:root {
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --bg: #0a0a1a;
    --bg-card: #12132a;
    --bg-card-hover: #1a1c3a;
    --text: #e8eaf6;
    --text-secondary: #9fa8da;
    --text-muted: #5c6bc0;
    --border: #1a237e20;
    --accent: #7c4dff;
    --accent-light: #b388ff;
    --accent-glow: rgba(124, 77, 255, 0.15);
    --success: #69f0ae;
    --radius: 14px;
    --radius-sm: 10px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(124, 77, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(179, 136, 255, 0.06) 0%, transparent 50%);
}

.app { max-width: 560px; margin: 0 auto; padding: 0 20px 80px; }

/* Header */
.header { text-align: center; padding: 40px 0 24px; }
.header h1 { font-size: 32px; font-weight: 800; letter-spacing: -1px; }
.gradient-text {
    background: linear-gradient(135deg, var(--accent), var(--accent-light), #ff80ab);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.subtitle { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

/* Section Label */
.section-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

/* Input */
.input-section { padding: 8px 0 4px; }

textarea {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 2px solid rgba(124, 77, 255, 0.1);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition);
}

textarea::placeholder { color: var(--text-muted); }
textarea:focus { border-color: var(--accent); }

.char-count {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Templates */
.template-section { padding: 16px 0; }

.template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.template-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 8px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.template-btn:hover { background: var(--bg-card-hover); }

.template-btn.active {
    border-color: var(--accent);
    background: var(--accent-glow);
    color: var(--text);
}

.template-icon { font-size: 22px; }
.template-name { font-size: 11px; font-weight: 600; }

/* AI Section */
.ai-section {
    margin: 8px 0 16px;
    border: 1px solid rgba(124, 77, 255, 0.1);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.ai-toggle {
    display: block;
    padding: 12px 16px;
    background: var(--bg-card);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    list-style: none;
    transition: color var(--transition);
}

.ai-toggle:hover { color: var(--text); }
.ai-toggle::-webkit-details-marker { display: none; }

.ai-content {
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid rgba(124, 77, 255, 0.1);
}

.ai-content input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid rgba(124, 77, 255, 0.15);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    outline: none;
}

.ai-content input:focus { border-color: var(--accent); }
.ai-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* Generate Button */
.btn-generate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    border: none;
    border-radius: var(--radius);
    color: white;
    font-family: var(--font);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition);
}

.btn-generate:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(124, 77, 255, 0.35);
}

.btn-generate:active { transform: scale(0.98); }

/* Output */
.output-section { padding: 24px 0; }

.output-cards { display: flex; flex-direction: column; gap: 12px; }

.output-card {
    background: var(--bg-card);
    border: 1px solid rgba(124, 77, 255, 0.08);
    border-radius: var(--radius);
    overflow: hidden;
    animation: fadeUp 0.4s ease-out;
}

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

.output-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(124, 77, 255, 0.06);
}

.platform-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
}

.platform-icon { font-size: 18px; }
.platform-limit { font-size: 11px; color: var(--text-muted); }

.btn-copy {
    padding: 6px 14px;
    background: var(--accent-glow);
    border: none;
    border-radius: 6px;
    color: var(--accent-light);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-copy:hover { background: rgba(124, 77, 255, 0.25); }
.btn-copy.copied { background: rgba(105, 240, 174, 0.15); color: var(--success); }

.output-card-body {
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    color: var(--text-secondary);
}

@media (max-width: 400px) {
    .template-grid { grid-template-columns: repeat(2, 1fr); }
}
