:root {
    --bg: #f8efe6;
    --bg-scene:
        radial-gradient(circle at top left, rgba(215, 123, 61, 0.18), transparent 30%),
        radial-gradient(circle at top right, rgba(24, 114, 93, 0.14), transparent 26%),
        linear-gradient(180deg, #fdf8f2 0%, #f7f0e6 54%, #efe7dd 100%);
    --surface: rgba(255, 251, 247, 0.9);
    --surface-strong: rgba(255, 254, 251, 0.98);
    --surface-soft: #fbf4ec;
    --line: rgba(87, 58, 36, 0.12);
    --text: #2d221b;
    --text-soft: #756458;
    --brand: #cb7138;
    --brand-strong: #9e4c20;
    --teal: #1b6f5e;
    --brand-muted: #f0ddce;
    --danger: #cf5143;
    --shadow-xl: 0 28px 60px rgba(66, 44, 27, 0.14);
    --shadow-lg: 0 18px 36px rgba(66, 44, 27, 0.1);
    --shadow-md: 0 10px 24px rgba(66, 44, 27, 0.08);
    --radius-xl: 32px;
    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    padding: 18px;
    color: var(--text);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-scene);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(158, 76, 32, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(158, 76, 32, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.24), transparent 76%);
}

.container {
    position: relative;
    max-width: 1520px;
    min-height: calc(100vh - 36px);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid rgba(255, 247, 239, 0.88);
    border-radius: var(--radius-xl);
    background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(248, 242, 235, 0.94));
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(12px);
}

header {
    position: relative;
    padding: 38px 34px 30px;
    text-align: center;
    color: #fff7f2;
    background:radial-gradient(circle at left top, rgba(255, 239, 225, 0.28), transparent 24%), radial-gradient(circle at right top, rgba(255, 203, 164, 0.2), transparent 22%), linear-gradient(135deg, #472413 0%, #409b40 46%, #409b40 100%);
}

header::after {
    content: '';
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 239, 225, 0.5), transparent);
}

header h1 {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(2.2rem, 2.8vw, 3.2rem);
    line-height: 1.04;
    letter-spacing: -0.05em;
}

header .subtitle {
    max-width: 760px;
    margin: 12px auto 0;
    font-size: 1rem;
    line-height: 1.65;
    color: rgba(255, 245, 237, 0.9);
}

.page-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 24px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid rgba(255, 242, 232, 0.16);
    border-radius: 999px;
    background: rgba(255, 244, 235, 0.12);
    color: #fff8f3;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.page-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 241, 231, 0.2);
    border-color: rgba(255, 241, 231, 0.3);
}

.page-link.active {
    background: rgba(255, 252, 248, 0.98);
    color: var(--brand-strong);
    border-color: rgba(255, 246, 239, 0.95);
}

.page-link.page-link-secondary {
    background: rgba(255, 244, 235, 0.08);
}

.header-nav {
    display: none;
}

main {
    padding: 28px 30px 34px;
}

.social-wrapper {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.input-section,
.platforms-section,
.hashtags-section,
.rephrase-card,
.platform-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(248, 241, 234, 0.9));
    box-shadow: var(--shadow-md);
}

.input-section::before,
.platforms-section::before,
.hashtags-section::before,
.rephrase-card::before,
.platform-card::before {
    content: '';
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--brand), var(--teal));
}

.input-section,
.platforms-section,
.hashtags-section {
    padding: 22px;
}

.input-section h2,
.platforms-section h2,
.hashtags-section h2 {
    margin: 0 0 14px;
    font-size: 1.12rem;
    color: var(--text);
    letter-spacing: -0.02em;
}

.input-section p,
.platforms-section p,
.hashtags-section p,
.rephrase-card p {
    color: var(--text-soft);
    line-height: 1.65;
}

.platform-buttons button {
	width: 45%;
}
.platform-card .platform-buttons {
	margin-top: 15px;
}
#platformHashtagGrid .platform-copy-btn {
	width: 100%;
}
.hashtag-buttons {
	margin-top: 15px;
}

.input-toolbar,
.rephrase-actions,
.platform-buttons,
.hashtag-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.toolbar-btn,
.generate-btn,
.optimize-btn,
.copy-btn,
.platform-copy-btn,
.clear-btn,
.rephrase-btn {
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #409b40 0%, #409b40 100%);
    color: white;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(158, 76, 32, 0.2);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.toolbar-btn:hover,
.generate-btn:hover,
.optimize-btn:hover,
.copy-btn:hover,
.platform-copy-btn:hover,
.clear-btn:hover,
.rephrase-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 30px rgba(158, 76, 32, 0.24);
}

.rephrase-btn.secondary,
.clear-btn {
    background: linear-gradient(135deg, #409b40 0%, #409b40 100%);
    color: #fff;
    border: 1px solid rgba(158, 76, 32, 0.14);
    box-shadow: none;
}

.generate-section {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.generate-btn {
    min-width: 220px;
    align-self: flex-start;
    border-radius: 16px;
}

#socialInput,
#hashtagsInput,
.platform-output,
.platform-textarea,
.rephrase-input,
.rephrase-output {
    width: 100%;
    min-height: 160px;
    padding: 16px 18px;
    color: var(--text);
    border: 1px solid rgba(87, 58, 36, 0.14);
    border-radius: 18px;
    background: var(--surface-strong);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#socialInput:focus,
#hashtagsInput:focus,
.platform-output:focus,
.platform-textarea:focus,
.rephrase-input:focus,
.rephrase-output:focus {
    outline: none;
    border-color: rgba(203, 113, 56, 0.44);
    box-shadow: 0 0 0 4px rgba(203, 113, 56, 0.12);
}

.input-stats,
.rephrase-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--text-soft);
}

.input-stats strong,
.rephrase-meta span:last-child,
.char-counter {
    color: var(--brand-strong);
    font-weight: 800;
}

.social-platforms,
.rephrase-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.platform-card,
.rephrase-card {
    padding: 18px;
}

.platform-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.platform-header h3,
.rephrase-card h3 {
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.05rem;
    color: var(--text);
}

.char-counter {
    padding: 8px 12px;
    border: 1px solid rgba(203, 113, 56, 0.18);
    border-radius: 999px;
    background: var(--surface-soft);
    font-size: 0.8rem;
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.options label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 0.88rem;
}

.options input[type='checkbox'] {
    accent-color: var(--brand);
}

.placeholder-text {
    margin: 20px 0;
    color: #9d8b7f;
    text-align: center;
    font-style: italic;
}

footer {
    padding: 18px 26px 24px;
    color: var(--text-soft);
    text-align: center;
    font-size: 0.84rem;
}

footer p {
    margin: 0;
}

.removable-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 74px;
    padding: 14px;
    border: 1px dashed rgba(203, 113, 56, 0.24);
    border-radius: 18px;
    background: linear-gradient(180deg, #fffdf9 0%, #f9f0e7 100%);
}

.removable-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(203, 113, 56, 0.14);
    border-radius: 999px;
    background: var(--brand-muted);
    color: var(--brand-strong);
    font-size: 0.84rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease;
}

.removable-tag:hover {
    transform: translateY(-1px);
    background: #ecd4c4;
}

.removable-tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 0.9rem;
    line-height: 1;
}

@media (max-width: 900px) {
    .social-platforms,
    .rephrase-grid {
        grid-template-columns: 1fr;
    }

    .platform-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 720px) {
    body {
        padding: 10px;
    }

    header {
        padding: 28px 18px 24px;
    }

    main {
        padding: 18px 16px 24px;
    }

    .page-nav,
    .options,
    .input-toolbar,
    .rephrase-actions,
    .hashtag-buttons,
    .platform-buttons {
        justify-content: flex-start;
    }

    .input-section,
    .platforms-section,
    .hashtags-section,
    .platform-card,
    .rephrase-card {
        padding: 16px;
    }
}
