/* ========================================
   PoemForTwo - Romantic Theme Styles
   ======================================== */

/* ========================================
   PoemForTwo - Chinese Classical Poetry Theme
   ======================================== */

/* --- Import Chinese Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700&family=Ma+Shan+Zheng&family=ZCOOL+XiaoWei&display=swap');

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --rose: #e8436e;
    --rose-light: #ff6b8a;
    --rose-dark: #c42857;
    --gold: #d4a853;
    --gold-light: #f0d48a;
    --cream: #fdf6f0;
    --cream-dark: #f5ece4;
    --warm-bg: #1a1410;
    --warm-card: #2a1f1a;
    --text-primary: #f0e8e0;
    --text-secondary: #b8a8a0;
    --text-muted: #8a7a72;
    --border: #3a2f2a;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 30px rgba(0,0,0,0.3);
    --font-cn-title: "Ma Shan Zheng", "STKaiti", serif;
    --font-cn: "Noto Serif SC", "ZCOOL XiaoWei", "STSong", serif;
    --font-cn-body: "ZCOOL XiaoWei", "Noto Serif SC", serif;
    --font-en: "Georgia", "Times New Roman", serif;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-en), var(--font-cn), serif;
    background: var(--warm-bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(232,67,110,0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(212,168,83,0.05) 0%, transparent 50%),
        repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(212,168,83,0.015) 40px, rgba(212,168,83,0.015) 41px);
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 40px 20px 60px;
}

/* --- Top Ornament --- */
.top-ornament {
    height: 6px;
    background: linear-gradient(90deg, transparent, var(--gold), var(--rose), var(--gold), transparent);
    opacity: 0.4;
}

/* --- Hero --- */
.hero {
    text-align: center;
    padding: 20px 0 36px;
    position: relative;
}

/* --- Top Bar: Brand + Lang Toggle --- */
.hero-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.brand-badge {
    font-family: var(--font-cn-body);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1px;
    opacity: 0.6;
}

.lang-toggle {
    padding: 6px 16px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-en);
    cursor: pointer;
    transition: all 0.25s ease;
}

.lang-toggle:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.hero-icon {
    display: none;
}

/* --- Chinese Seal Mark --- */
.seal-mark {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    border: 3px solid var(--rose);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: "Ma Shan Zheng", var(--font-cn-title);
    font-size: 34px;
    color: var(--rose);
    transform: rotate(-3deg);
    position: relative;
}

.seal-mark::after {
    content: '';
    position: absolute;
    inset: -3px;
    border: 1px solid rgba(232,67,110,0.2);
    border-radius: 8px;
}

.hero h1 {
    font-family: "Ma Shan Zheng", var(--font-cn-title);
    font-size: 48px;
    font-weight: 400;
    background: linear-gradient(135deg, var(--rose-light), var(--gold-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 4px;
    margin-bottom: 4px;
}

.subtitle-chinese {
    font-family: var(--font-cn-body);
    font-size: 20px;
    color: var(--gold);
    margin-bottom: 8px;
    letter-spacing: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 15px;
    margin-top: 4px;
    line-height: 1.6;
}

.lang-tag {
    display: inline-block;
    margin-top: 8px;
    padding: 4px 16px;
    background: rgba(212,168,83,0.12);
    border: 1px solid rgba(212,168,83,0.25);
    border-radius: 20px;
    font-size: 13px;
    color: var(--gold);
    font-family: var(--font-cn-body);
}

/* --- Floating Quote Scroll --- */
.quote-scroll {
    margin-top: 28px;
    padding: 16px 24px;
    background: rgba(212,168,83,0.04);
    border-left: 2px solid rgba(212,168,83,0.2);
    border-right: 2px solid rgba(212,168,83,0.2);
    border-radius: 4px;
    transition: opacity 0.5s;
}

.quote-line {
    font-family: var(--font-cn-title);
    font-size: 24px;
    color: var(--gold-light);
    letter-spacing: 2px;
    transition: opacity 0.4s ease;
}

.quote-source {
    font-family: var(--font-cn-body);
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
    transition: opacity 0.4s ease;
}

/* --- Cards --- */
.card {
    background: var(--warm-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--text-primary);
}

/* --- Card Header Ornament --- */
.card-header-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.ornament-line {
    display: block;
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold));
}

.ornament-line:last-of-type {
    background: linear-gradient(90deg, var(--gold), transparent);
}

.ornament-dot {
    color: var(--gold);
    font-size: 10px;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 0.5px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group.half {
    flex: 1;
}

.optional {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}

input, textarea {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 15px;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

input:focus, textarea:focus {
    border-color: var(--rose);
    box-shadow: 0 0 0 3px rgba(232,67,110,0.15);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

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

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* --- Format Selector --- */
.format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.format-btn {
    padding: 12px 8px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-cn-body), var(--font-en), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    line-height: 1.4;
}

.format-btn:hover {
    background: rgba(212,168,83,0.08);
    border-color: var(--gold);
}

.format-btn.selected {
    background: rgba(212,168,83,0.12);
    border-color: var(--gold);
    color: var(--gold-light);
}

.format-desc {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.format-btn.selected .format-desc {
    color: var(--gold);
    opacity: 0.7;
}

/* --- Relationship Grid --- */
.relationship-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.rel-btn {
    padding: 10px 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: center;
    line-height: 1.3;
}

.rel-btn:hover {
    background: rgba(232,67,110,0.08);
    border-color: var(--rose);
    color: var(--text-primary);
}

.rel-btn.selected {
    background: rgba(232,67,110,0.15);
    border-color: var(--rose);
    color: var(--rose-light);
    font-weight: 500;
    box-shadow: 0 0 12px rgba(232,67,110,0.15);
}

/* --- Primary Button --- */
.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--rose), var(--rose-dark));
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(232,67,110,0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

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

/* --- Preview Section --- */
.hidden {
    display: none !important;
}

.preview-section {
    margin-top: 40px;
    animation: fadeUp 0.5s ease;
}

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

/* --- Poem Card --- */
.poem-card {
    text-align: center;
}

.poem-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.poem-seal {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 2px solid var(--rose);
    border-radius: 4px;
    font-family: "Ma Shan Zheng", var(--font-cn-title);
    font-size: 20px;
    color: var(--rose);
    line-height: 36px;
    text-align: center;
    margin-bottom: 12px;
    transform: rotate(-3deg);
}

.poem-header h2 {
    margin-bottom: 8px;
    font-family: "Ma Shan Zheng", var(--font-cn-title);
    font-size: 30px;
    color: var(--gold);
    font-weight: 400;
    letter-spacing: 2px;
}

.poem-dedication {
    font-size: 15px;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Poem Verses --- */
.poem-body {
    min-height: 100px;
}

.chinese-verse {
    font-family: var(--font-cn-body);
    font-size: 18px;
    line-height: 2.4;
    color: var(--text-primary);
    white-space: pre-line;
    padding: 8px 0;
}

/* --- Section Labels --- */
.section-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gold);
    opacity: 0.6;
    margin-bottom: 8px;
    font-family: var(--font-en);
}

/* --- Interpretation Verse --- */
.interpret-verse {
    font-family: var(--font-en);
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-muted);
    white-space: pre-line;
    padding: 8px 0;
    font-style: normal;
}

.english-verse {
    font-family: var(--font-en);
    font-size: 15px;
    line-height: 1.9;
    color: var(--text-secondary);
    font-style: italic;
    white-space: pre-line;
    padding: 8px 0;
}

.divider {
    color: var(--gold);
    font-size: 14px;
    padding: 16px 0;
    letter-spacing: 6px;
}

.poem-signature {
    font-size: 14px;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 12px;
}

/* --- Blurred Content --- */
.blur-overlay {
    position: relative;
    filter: blur(5px);
    pointer-events: none;
    user-select: none;
    transition: filter 0.5s;
}

/* --- LemonSqueezy Button --- */
.btn-ls {
    display: inline-block;
    padding: 16px 40px;
    background: linear-gradient(135deg, #1ee0ac, #16a085);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff !important;
    font-size: 17px;
    font-weight: 600;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    margin-bottom: 12px;
}

.btn-ls:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(30,224,172,0.35);
}

/* --- Paywall --- */
.locked-content {
    margin-top: 10px;
}

.paywall {
    margin-top: 28px;
    padding: 32px 20px;
    background: linear-gradient(135deg, rgba(232,67,110,0.08), rgba(212,168,83,0.08));
    border: 1px solid rgba(212,168,83,0.2);
    border-radius: var(--radius);
}

.lock-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.paywall h3 {
    font-family: "Ma Shan Zheng", var(--font-cn-title);
    font-size: 24px;
    font-weight: 400;
    color: var(--gold);
    margin-bottom: 8px;
}

.pay-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

#paypal-button-container {
    max-width: 280px;
    margin: 0 auto 12px;
}

.pay-note {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Poem Actions --- */
.poem-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.btn-secondary {
    padding: 12px 24px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    border-color: var(--gold);
}

.btn-outline {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-family: var(--font-en), var(--font-cn), sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
}

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--text-muted);
}

/* --- Loading State --- */
.btn-text.hidden { display: none; }
.btn-loading.hidden { display: none; }

/* --- Footer Poem Quote --- */
.footer-poem {
    text-align: center;
    padding: 32px 20px 10px;
}

.footer-poem-line {
    font-family: var(--font-cn-title);
    font-size: 18px;
    color: var(--text-muted);
    letter-spacing: 2px;
    opacity: 0.6;
}

.footer-poem-source {
    font-family: var(--font-cn-body);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.4;
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 40px 20px 30px;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.footer-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
}

.footer-company {
    font-family: var(--font-cn-body);
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.footer-slogan {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.footer-small {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.privacy-notice {
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.6;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .container {
        padding: 20px 16px 40px;
    }

    .hero {
        padding: 40px 0 28px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero-icon {
        font-size: 48px;
    }

    .card {
        padding: 24px 20px;
    }

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

    .rel-btn {
        font-size: 12px;
        padding: 8px 4px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .poem-header h2 {
        font-size: 22px;
    }

    .chinese-verse {
        font-size: 16px;
    }

    .english-verse {
        font-size: 14px;
    }

    .poem-actions {
        flex-direction: column;
    }

    .btn-secondary, .btn-outline {
        width: 100%;
    }
}

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

/* --- Accessibility: Focus Visible --- */
:focus-visible {
    outline: 2px solid var(--rose);
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Accessibility: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .quote-scroll,
    .seal-mark,
    .fade-in {
        animation: none !important;
    }
}
