﻿:root {
    --p: #FF6B9D; --pd: #E5558A; --pl: #FF8FB3; --s: #C084FC; --bg: #FFF5F7;
    --card: #FFFFFF; --t: #2D2D3A; --tl: #9999A8; --b: #F0E6EE;
    --sh: 0 2px 12px rgba(255,107,157,.15); --r: 16px; --rs: 10px;
    --sb: env(safe-area-inset-bottom,0px);
}
*{margin:0;padding:0;box-sizing:border-box}
body{padding-top:env(safe-area-inset-top,0px);-webkit-font-smoothing:antialiased}


/* Tab Bar */
.tab-bar{position:fixed;bottom:0;left:0;right:0;width:100%;background:var(--card);display:flex;justify-content:space-around;padding:8px 0 calc(8px + var(--sb));border-top:1px solid var(--b);z-index:2000;backdrop-filter:blur(20px)}
.tab-item{display:flex;flex-direction:column;align-items:center;gap:2px;padding:4px 12px;cursor:pointer;transition:.2s;-webkit-tap-highlight-color:transparent}
.tab-icon{font-size:20px;line-height:1}.tab-label{font-size:10px;color:var(--tl);font-weight:500}.tab-item.active .tab-label{color:var(--p)}

/* Pages */
.page{display:none;flex:1;width:100%;overflow-y:auto;padding-bottom:60px;animation:fadeIn .3s ease}.page.active{display:flex;flex-direction:column;height:100%}
@keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.page-header{padding:20px 0 16px;text-align:center}
.page-header h1{font-size:22px;font-weight:700;background:linear-gradient(135deg,var(--p),var(--s));-webkit-background-clip:text;-webkit-text-fill-color:transparent;margin-bottom:4px}
.subtitle{font-size:12px;color:var(--tl);line-height:1.5}


/* Style Grid */

.style-item{flex-shrink:0;padding:4px 10px;border:1.5px solid var(--b);border-radius:14px;text-align:center;font-size:10px;font-weight:500;cursor:pointer;background:var(--card);transition:.2s;line-height:1.3;white-space:nowrap}
.style-item:active{transform:scale(.95)}
.style-item.selected{border-color:var(--p);background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd);box-shadow:0 2px 8px rgba(255,107,157,.2)}

/* Inputs */
.input-section{margin-bottom:14px}.input-group{margin-bottom:10px}
.input-label{display:block;font-size:12px;font-weight:600;color:var(--t);margin-bottom:6px}
.text-input{width:100%;padding:10px 14px;border:2px solid var(--b);border-radius:var(--rs);font-size:14px;font-family:inherit;background:var(--card);color:var(--t);transition:.2s;outline:none;-webkit-appearance:none;resize:none;line-height:1.6}
.text-input:focus{border-color:var(--p);box-shadow:0 0 0 3px rgba(255,107,157,.15)}
select.text-input{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239999A8' stroke-width='2' fill='none'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 14px center;padding-right:36px}

/* Trait Grid */
.trait-grid{display:flex;flex-wrap:wrap;gap:8px}
.trait-item{padding:7px 14px;border:2px solid var(--b);border-radius:20px;font-size:12px;font-weight:500;cursor:pointer;transition:.2s;background:var(--card)}
.trait-item:active{transform:scale(.95)}
.trait-item.selected{border-color:var(--s);background:linear-gradient(135deg,#F3E8FF,#FAF5FF);color:#7C3AED}

/* Buttons */
.btn-primary{width:100%;padding:13px;border:none;border-radius:var(--r);background:linear-gradient(135deg,var(--p),var(--s));color:white;font-size:15px;font-weight:600;cursor:pointer;box-shadow:0 4px 16px rgba(255,107,157,.3);margin-bottom:14px;transition:.2s}
.btn-primary:active{transform:scale(.98);opacity:.9}
.btn-primary:disabled{opacity:.5}
.btn-sm{padding:6px 14px;border:none;border-radius:20px;background:var(--p);color:white;font-size:12px;font-weight:600;cursor:pointer}

/* Loading */
.loading{display:flex;align-items:center;justify-content:center;gap:10px;padding:20px;color:var(--tl);font-size:13px}
.spinner{width:20px;height:20px;border:3px solid var(--b);border-top-color:var(--p);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* Result Cards */
.result-section{margin-bottom:14px}
.reply-cards{display:flex;flex-direction:column;gap:10px}
.reply-card{background:var(--card);border-radius:var(--r);padding:14px;box-shadow:var(--sh);position:relative}
.reply-card .card-num{font-size:11px;color:var(--tl);font-weight:600;margin-bottom:6px}
.reply-card .card-text{font-size:15px;line-height:1.7;color:var(--t)}
.reply-card .card-actions{display:flex;gap:8px;margin-top:10px}
.reply-card .card-actions button{padding:6px 12px;border:1px solid var(--b);border-radius:16px;font-size:12px;cursor:pointer;background:var(--card);color:var(--t);transition:.2s}
.reply-card .card-actions button:active{background:var(--bg)}
.reply-card .card-actions .btn-star{color:var(--tl);font-size:16px;padding:4px 8px}
.reply-card .card-actions .btn-star.active{color:#F59E0B}

/* Result Content */
.result-content{font-size:14px;line-height:1.8;white-space:pre-wrap;color:var(--t)}
.result-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;font-weight:600;font-size:13px;color:var(--pd)}
.analyze-section{margin-bottom:8px}.analyze-section h3{font-size:13px;color:var(--pd);margin-bottom:4px;border-bottom:2px solid var(--b);padding-bottom:3px}.analyze-section p{font-size:13px;line-height:1.6}

/* Provider Toggle */
.provider-toggle{display:flex;border-radius:var(--rs);overflow:hidden;border:2px solid var(--b)}
.provider-option{flex:1;padding:11px;text-align:center;font-size:14px;font-weight:600;cursor:pointer;background:var(--card);color:var(--tl);transition:.2s}
.provider-option:first-child{border-right:1px solid var(--b)}
.provider-option.active{background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd)}
.provider-config{margin-top:12px}

/* History */
.history-tabs{display:flex;gap:0;margin-bottom:14px;background:var(--card);border-radius:20px;overflow:hidden;border:2px solid var(--b)}
.htab{flex:1;padding:8px;text-align:center;font-size:13px;font-weight:600;cursor:pointer;color:var(--tl);transition:.2s}
.htab.active{background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd)}
.history-list{display:flex;flex-direction:column;gap:10px}
.history-item{background:var(--card);border-radius:var(--r);padding:14px;box-shadow:var(--sh)}
.history-item .hi-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}
.history-item .hi-meta{font-size:11px;color:var(--tl)}
.history-item .hi-context{font-size:12px;color:var(--tl);font-style:italic;margin-bottom:8px;padding:6px 10px;background:var(--bg);border-radius:8px}
.history-item .hi-replies{display:flex;flex-direction:column;gap:4px}
.history-item .hi-reply{font-size:13px;line-height:1.5;padding:6px 10px;background:var(--bg);border-radius:8px;position:relative}
.history-item .hi-reply .hi-copy{position:absolute;right:8px;top:6px;font-size:14px;cursor:pointer;opacity:.5}
.history-item .hi-reply .hi-copy:active{opacity:1}
.history-item .hi-actions{display:flex;gap:8px;margin-top:8px;justify-content:flex-end}
.history-item .hi-actions button{font-size:12px;padding:4px 10px;border:1px solid var(--b);border-radius:12px;cursor:pointer;background:var(--card)}
.empty-state{text-align:center;padding:40px;color:var(--tl);font-size:14px}

/* Toast */
.toast{display:none;text-align:center;padding:10px;background:#10B981;color:white;border-radius:var(--rs);font-size:13px;font-weight:500;margin-top:8px}
.toast.show{display:block;animation:slideUp .3s ease}
@keyframes slideUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}

/* About */
.about-section{background:var(--card);border-radius:var(--r);padding:18px;margin-top:18px;box-shadow:var(--sh)}
.about-section h3{color:var(--p);margin-bottom:8px;font-size:15px}
.about-section p{font-size:12px;color:var(--tl);line-height:1.6;margin-bottom:4px}
.version{text-align:center;color:var(--tl);font-size:11px;margin-top:10px;padding-top:10px;border-top:1px solid var(--b)}

/* Settings gear */
.config-badge{position:fixed;top:12px;right:12px;width:36px;height:36px;border-radius:50%;background:var(--card);box-shadow:var(--sh);display:flex;align-items:center;justify-content:center;font-size:18px;cursor:pointer;z-index:99;display:none}


/* Top bar */

.top-info{font-size:12px;color:var(--tl)}
.gear-btn{font-size:15px;cursor:pointer;padding:12px 20px;border-radius:22px;transition:.2s;background:linear-gradient(135deg,var(--p),#FF8FB3);color:#fff;font-weight:600;box-shadow:0 2px 8px rgba(255,107,157,.25);display:inline-flex;align-items:center;gap:4px;white-space:nowrap}
.gear-btn:active{opacity:.8;transform:scale(.95)}
.gear-btn-close{font-size:20px;cursor:pointer;padding:4px 8px;border-radius:8px;transition:.2s;background:transparent;color:var(--tl)}
.gear-btn-close:active{background:var(--bg)}

/* Mode toggle (Generate/Polish) */

.mode-tab{flex:1;padding:9px;text-align:center;font-size:13px;font-weight:600;cursor:pointer;color:var(--tl);transition:.2s}
.mode-tab.active{background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd)}


/* 3-mode toggle */
.mode-3 .mode-tab { font-size: 12px; padding: 8px 4px; }

/* Overlay */
.overlay{position:fixed;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.4);z-index:200;display:flex;align-items:flex-end;justify-content:center;animation:fadeIn .2s ease}
.overlay-content{background:var(--card);width:100%;max-width:480px;max-height:80vh;border-radius:20px 20px 0 0;padding:16px;overflow-y:auto}
.overlay-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
.overlay-header h3{font-size:16px;color:var(--p)}
.template-cats{display:flex;gap:6px;overflow-x:auto;padding-bottom:8px;margin-bottom:10px}
.template-cat{flex-shrink:0;padding:7px 12px;border:2px solid var(--b);border-radius:16px;font-size:12px;font-weight:500;cursor:pointer;white-space:nowrap;background:var(--card);transition:.2s}
.template-cat.selected{border-color:var(--p);background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd)}
.template-list{display:flex;flex-direction:column;gap:6px}
.template-item{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:var(--bg);border-radius:10px;font-size:13px;line-height:1.4}
.template-item .tcopy{padding:4px 10px;border:1px solid var(--b);border-radius:12px;font-size:12px;cursor:pointer;background:var(--card);flex-shrink:0;margin-left:8px}


/* Floating settings button (mobile friendly) */
.floating-settings{position:fixed;bottom:90px;left:16px;width:50px;height:50px;border-radius:50%;background:linear-gradient(135deg,var(--p),var(--s));color:#fff;font-size:22px;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 16px rgba(255,107,157,.4);cursor:pointer;z-index:99;border:none;-webkit-tap-highlight-color:transparent}
.floating-settings:active{transform:scale(.92);opacity:.9}


/* VIP Plans */
.plan-list{display:flex;flex-direction:column;gap:12px;margin-top:4px}
.plan-card{background:var(--card);border-radius:var(--r);padding:16px;box-shadow:var(--sh);border:2px solid var(--b);position:relative;cursor:pointer;transition:.2s}
.plan-card:active{transform:scale(.98)}
.plan-card.popular{border-color:#F59E0B;background:linear-gradient(135deg,#FFFBEB,#FFF5F7)}
.plan-card .plan-badge{position:absolute;top:-8px;right:12px;background:linear-gradient(135deg,#F59E0B,#D97706);color:white;font-size:10px;font-weight:700;padding:3px 10px;border-radius:10px}
.plan-card .plan-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}
.plan-card .plan-name{font-size:16px;font-weight:700}
.plan-card .plan-price{font-size:20px;font-weight:800;color:var(--p)}
.plan-card .plan-price small{font-size:12px;font-weight:500;color:var(--tl)}
.plan-card .plan-desc{font-size:12px;color:var(--tl)}
.plan-card .plan-limit{font-size:11px;color:var(--tl);margin-top:4px}
.plan-card .btn-buy{width:100%;padding:10px;margin-top:10px;border:none;border-radius:12px;background:linear-gradient(135deg,var(--p),var(--s));color:white;font-size:14px;font-weight:600;cursor:pointer}
.plan-card .btn-buy:active{opacity:.8}


/* Gender Toggle */
.gender-toggle{display:flex;gap:8px}
.gender-option{flex:1;padding:10px;text-align:center;border:2px solid var(--b);border-radius:12px;font-size:14px;font-weight:600;cursor:pointer;background:var(--card);transition:.2s}
.gender-option:active{transform:scale(.97)}
.gender-option.active{border-color:var(--p);background:linear-gradient(135deg,#FFF0F5,#FFF5F7);color:var(--pd)}


/* === Online Learning System === */
.feedback-prompt {
    display: none;
    margin: 12px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    border-radius: 12px;
    font-size: 14px;
}
.feedback-prompt .fp-title {
    font-weight: bold;
    margin-bottom: 8px;
    color: #92400e;
}
.feedback-prompt .fp-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.feedback-prompt .fp-btn {
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #d97706;
    background: white;
    color: #92400e;
    font-size: 13px;
    cursor: pointer;
}
.feedback-prompt .fp-btn:hover {
    background: #fef3c7;
}
.feedback-prompt .fp-btn.yes { background: #34d399; color: white; border-color: #059669; }
.feedback-prompt .fp-btn.yes:hover { background: #10b981; }
.feedback-prompt .fp-btn.no { background: #f87171; color: white; border-color: #dc2626; }
.feedback-prompt .fp-btn.no:hover { background: #ef4444; }

.learning-dashboard {
    padding: 12px;
}
.learning-summary {
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 16px;
    margin-bottom: 16px;
    font-size: 15px;
}
.learning-ranking h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #333;
}
.learning-ranking table {
    width: 100%;
    border-collapse: collapse;
}
.learning-ranking td, .learning-ranking th {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 14px;
}
.learning-ranking th {
    color: #666;
    font-weight: 600;
}
.score-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}
.score-fill {
    height: 8px;
    border-radius: 4px;
    min-width: 4px;
    transition: width 0.3s;
}
.learning-ranking .score-bar span {
    font-size: 12px;
    color: #666;
    min-width: 30px;
}


/* === A/B Testing === */
.ab-container {
    padding: 12px;
}
.ab-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.ab-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}
.ab-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-weight: 600;
}
.ab-section {
    background: white;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ab-section h3 {
    font-size: 15px;
    margin-bottom: 10px;
    color: #333;
}
.ab-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.ab-table th, .ab-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #f3f4f6;
}
.ab-table th {
    color: #666;
    font-weight: 600;
    font-size: 12px;
}
.ab-row {
    margin-bottom: 10px;
}
.ab-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #555;
}
.ab-row select {
    margin-left: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
    font-size: 13px;
}
.ab-content {
    display: none;
}
.ab-content.active {
    display: block;
}
.ab-results {
    min-height: 200px;
}


/* === Active Prompt Suggestions === */
.suggestion-section {
    margin: 8px 0;
    padding: 10px 12px;
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border-radius: 12px;
    border: 1px solid #C7D2FE;
    animation: slideDown 0.3s ease;
}
.suggestion-header {
    font-size: 13px;
    font-weight: 600;
    color: #4338CA;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #E0E7FF;
}
.suggestion-item:active {
    transform: scale(0.98);
    background: #F5F3FF;
}
.suggestion-type {
    font-size: 11px;
    font-weight: 600;
    color: #6366F1;
    white-space: nowrap;
    min-width: 70px;
    padding: 2px 6px;
    background: #EEF2FF;
    border-radius: 6px;
    text-align: center;
}
.suggestion-content {
    font-size: 13px;
    color: #1E1B4B;
    line-height: 1.4;
    flex: 1;
}
.suggestion-scenario {
    font-size: 11px;
    color: #6366F1;
    padding: 2px 8px;
    background: #E0E7FF;
    border-radius: 8px;
    display: inline-block;
    margin-bottom: 6px;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}


/* === Long-term Memory === */
.memory-section {
    animation: slideDown 0.3s ease;
}
.memory-item {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 6px 8px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 4px;
    border: 1px solid #E5E7EB;
    font-size: 12px;
    line-height: 1.4;
}
.memory-item .mem-cat {
    font-size: 10px;
    color: #6366F1;
    background: #EEF2FF;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 500;
}
.memory-item .mem-text {
    flex: 1;
    color: #374151;
}
.memory-item .mem-del {
    font-size: 14px;
    cursor: pointer;
    color: #9CA3AF;
    padding: 0 2px;
}
.memory-item .mem-del:hover {
    color: #EF4444;
}
.memory-empty {
    text-align: center;
    padding: 16px;
    color: #9CA3AF;
    font-size: 13px;
}
.memory-add-row{
    display:flex!important;
    align-items:center!important;
    gap:6px!important;
    width:100%;
}
.memory-add-row #memoryInput{
    flex:1 1 auto!important;
    min-width:0!important;
    height:36px!important;
    padding:7px 10px!important;
}
.memory-add-row #memoryCategory{
    flex:0 0 72px!important;
    width:72px!important;
    height:36px!important;
    padding:7px 22px 7px 8px!important;
    font-size:12px!important;
}
.memory-add-row .btn-primary{
    flex:0 0 78px!important;
    width:78px!important;
    height:36px!important;
    margin:0!important;
    padding:0!important;
    border-radius:18px!important;
    font-size:12px!important;
    white-space:nowrap!important;
}
.memory-count {
    font-size: 11px;
    color: #6366F1;
    margin-bottom: 6px;
}









html,body{overflow-x:hidden;width:100%;max-width:100%}
#app{width:100%;max-width:100%;overflow:hidden;height:100dvh;display:flex;flex-direction:column}
.style-item{padding:6px 2px;font-size:11px}
.tab-item{padding:2px 6px}
.tab-item .tab-icon{font-size:16px}
.tab-item .tab-label{font-size:9px;white-space:nowrap}
@media(max-width:360px){.style-grid{grid-template-columns:repeat(2,1fr);gap:4px}}
/* Compact style selector */
.mode-switch{display:flex;gap:6px;padding:8px 16px 0;background:#fff}
.mode-tab{flex:1;border:1.5px solid var(--b);background:var(--card);color:var(--tl);border-radius:16px;padding:8px 0;font-size:13px;font-weight:600;cursor:pointer}
.mode-tab.active{border-color:var(--p);background:#FEF2F8;color:var(--p)}
.handbook-panel{margin:8px 16px 0;padding:10px;background:#fff;border:1px solid #F3DDE8;border-radius:14px;box-shadow:0 2px 10px rgba(255,107,157,.08)}
.handbook-title{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;font-size:13px;font-weight:700;color:#374151}
.handbook-title button{border:0;background:#F3F4F6;color:#6B7280;border-radius:12px;padding:4px 10px;font-size:11px;cursor:pointer}
.handbook-cats,.handbook-topics{display:flex;gap:6px;overflow-x:auto;padding:2px 0 6px;scrollbar-width:none}
.handbook-cats::-webkit-scrollbar,.handbook-topics::-webkit-scrollbar{display:none}
.handbook-cat,.handbook-topic{flex-shrink:0;border:1.5px solid #E5E7EB;background:#fff;color:#4B5563;border-radius:16px;padding:6px 10px;font-size:12px;white-space:nowrap;cursor:pointer}
.handbook-cat.selected,.handbook-topic.selected{border-color:var(--p);background:#FEF2F8;color:var(--p);font-weight:700}
.handbook-selected{font-size:11px;color:#9CA3AF;padding-top:2px}
.style-header{display:flex;align-items:center;gap:6px;margin-bottom:4px}
.style-header .input-label-s{font-weight:600;font-size:12px;color:#374151;white-space:nowrap}
.style-header .sel-style{font-size:11px;color:var(--p);background:#FEF2F8;padding:2px 10px;border-radius:10px}
.style-scroll-x{display:flex;flex-wrap:wrap;gap:4px;max-height:140px;overflow-y:auto;padding:4px;scrollbar-width:thin}
.style-scroll-x::-webkit-scrollbar{width:3px}
.style-scroll-x::-webkit-scrollbar-thumb{background:#D1D5DB;border-radius:3px}

/* ===== Chat Reply Cards ===== */
.reply-list{padding:0 0 12px}
.reply-card-chat{margin-bottom:10px;animation:fadeIn .3s ease}
.reply-card-chat.recommended{animation:fadeIn .4s ease}
.reply-card-chat .rc-bubble{background:var(--card);border:1.5px solid #E5E7EB;border-radius:16px;padding:14px 16px;position:relative;transition:.2s;cursor:pointer}
.reply-card-chat .rc-bubble:active{transform:scale(.98)}
.reply-card-chat.recommended .rc-bubble{background:linear-gradient(135deg,#FEF2F8,#FFF5F7);border-color:#F9A8D4;box-shadow:0 2px 12px rgba(255,107,157,.15)}
.reply-card-chat .rc-badge{font-size:11px;font-weight:600;color:#EC4899;margin-bottom:6px;display:flex;align-items:center;gap:4px}
.reply-card-chat .rc-text{font-size:15px;line-height:1.5;color:#1F2937;margin-bottom:8px;word-break:break-word}
.reply-card-chat .rc-tags{font-size:11px;color:#9CA3AF;display:flex;gap:6px;flex-wrap:wrap}
.reply-card-chat .rc-tags span{background:#F3F4F6;padding:1px 8px;border-radius:8px;color:#6B7280}
.reply-card-chat .rc-copy-btn{position:absolute;right:12px;top:50%;transform:translateY(-50%);font-size:18px;color:#D1D5DB;cursor:pointer;padding:4px;border-radius:8px;transition:.2s}
.reply-card-chat .rc-copy-btn:hover,.reply-card-chat .rc-copy-btn:active{color:var(--p);background:#FEF2F8}
.recommended .rc-copy-btn{color:#EC4899}
.refresh-btn{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;padding:10px;margin:2px 0 8px;background:var(--card);border:1.5px dashed #D1D5DB;border-radius:12px;font-size:13px;color:#6B7280;cursor:pointer;transition:.2s}
.refresh-btn:active{background:#F3F4F6;transform:scale(.98)}
@keyframes fadeIn{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:translateY(0)}}
.reply-card-chat.recommended .rc-bubble{border-left:4px solid #EC4899}
/* New Chat Layout overrides */
.input-row .btn-primary{width:auto}
.reply-list{padding:0}
.chat-main{flex:1;overflow-y:auto;padding:12px 16px}

/* VIP mobile layout fix */
#page-vip{
  background:#fff;
  padding:0 14px 76px;
  box-sizing:border-box;
  align-items:center;
}
.vip-mobile-wrap{
  width:100%;
  max-width:430px;
  margin:0 auto;
  padding:14px 0 24px;
  box-sizing:border-box;
}
.vip-hero{
  border-radius:18px;
  padding:18px 16px;
  background:linear-gradient(135deg,#fff0f6,#f5e8ff);
  border:1px solid #ffd1e2;
  margin-bottom:12px;
  text-align:center;
}
.vip-title{font-size:22px;font-weight:800;color:#ff5b93;margin-bottom:4px}
.vip-subtitle{font-size:12px;color:#8b5b72;line-height:1.5}
.vip-status{
  border-radius:14px;
  padding:12px 14px;
  background:#fff7fb;
  border:1px solid #ffd1e2;
  margin-bottom:12px;
  font-size:13px;
  color:#7c2d12;
}
.vip-plan-list{gap:10px;margin-top:0;width:100%}
#page-vip .plan-card{
  width:100%;
  box-sizing:border-box;
  border-radius:16px;
  padding:14px;
  min-height:auto;
  overflow:hidden;
}
#page-vip .plan-card::after{display:none!important}
#page-vip .plan-card > div:first-child{font-size:16px!important;line-height:1.3}
#page-vip .btn-buy{
  display:block;
  width:100%;
  min-height:42px;
  margin-top:12px;
  border:none;
  border-radius:999px;
  background:linear-gradient(135deg,#ff5b93,#b768ff);
  color:#fff;
  font-size:14px;
  font-weight:700;
}
#page-vip .btn-buy:disabled{background:#f3d4df;color:#9f6b80}
@media (min-width:768px){
  #page-vip{background:#fafafa}
  .vip-mobile-wrap{max-width:430px}
}

/* Payment modal */
.payment-modal{width:calc(100% - 32px);max-width:360px;background:#fff;border-radius:18px;padding:16px;box-shadow:0 18px 60px rgba(0,0,0,.18)}
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.38);z-index:999;align-items:center;justify-content:center;padding:16px;box-sizing:border-box}
.overlay-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
.overlay-header h3{margin:0;font-size:18px;color:var(--p)}


/* Restored handbook + memory controls */
.handbook-cats,.handbook-topics{display:flex;gap:8px;overflow-x:auto;padding:2px 0 8px;scrollbar-width:none}.handbook-cats::-webkit-scrollbar,.handbook-topics::-webkit-scrollbar{display:none}.handbook-cat,.handbook-topic{border:1px solid #E5E7EB;background:#fff;border-radius:999px;padding:6px 12px;font-size:12px;color:#374151;white-space:nowrap}.handbook-cat.selected,.handbook-topic.selected{border-color:#FF6B9D;color:#FF2D75;background:#FFF0F6}.memory-item{display:flex;align-items:center;gap:6px}.memory-item .mem-text{flex:1}.mem-del{border:0;background:#FEE2E2;color:#DC2626;border-radius:999px;padding:3px 8px;font-size:11px}


/* Mobile browser adaptation - phone first */
:root{
  --app-max:430px;
  --tab-h:64px;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
}
html,body{
  width:100%;
  min-height:100%;
  overflow:hidden;
  background:#f7f7fb;
  touch-action:manipulation;
}
body{
  display:flex;
  justify-content:center;
  padding:0;
  overscroll-behavior:none;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
}
#app{
  position:relative;
  width:100%;
  max-width:var(--app-max);
  height:100dvh;
  min-height:100dvh;
  margin:0 auto;
  background:#fff;
  overflow:hidden;
  box-shadow:0 0 0 1px rgba(0,0,0,.04),0 18px 60px rgba(15,23,42,.10);
}
.tab-bar{
  left:50%;
  right:auto;
  transform:translateX(-50%);
  width:100%;
  max-width:var(--app-max);
  min-height:var(--tab-h);
  padding:7px 6px calc(7px + var(--safe-bottom));
  box-sizing:border-box;
  border-radius:18px 18px 0 0;
  z-index:2000!important;
  pointer-events:auto!important;
}
.tab-item{
  flex:1;
  min-width:0;
  padding:4px 2px;
}
.tab-icon{font-size:18px}.tab-label{font-size:10px;line-height:1.2;white-space:nowrap}
.page{
  height:100dvh!important;
  max-height:100dvh;
  padding:calc(10px + var(--safe-top)) 10px calc(var(--tab-h) + var(--safe-bottom) + 12px)!important;
  overflow-y:auto;
  overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
}
#page-generate{
  height:calc(100dvh - var(--tab-h) - var(--safe-bottom))!important;
  padding:0!important;
  overflow:hidden!important;
}
#page-generate > div:first-of-type{
  padding-top:calc(10px + var(--safe-top))!important;
  min-height:64px;
  height:auto!important;
}
#replyArea{
  flex:1 1 auto!important;
  min-height:0;
  padding:10px 10px!important;
}
#page-generate > div:last-of-type{
  padding:8px 10px calc(10px + var(--safe-bottom))!important;
  background:rgba(250,250,250,.96)!important;
  backdrop-filter:blur(14px);
  z-index:20;
}
.handbook-panel{
  margin:0!important;
  border-left:0!important;
  border-right:0!important;
  border-radius:0!important;
  padding:8px 10px!important;
  max-height:128px;
  overflow:hidden;
}
.handbook-cats,.handbook-topics{
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  -webkit-overflow-scrolling:touch;
}
.style-scroll-x{
  display:flex!important;
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  max-height:none!important;
  padding:4px 0!important;
  -webkit-overflow-scrolling:touch;
}
.style-item{font-size:11px;padding:6px 10px;border-radius:999px}
.input-row{width:100%;display:flex!important;align-items:flex-end!important;gap:8px!important}
.input-row .text-input,#contextInput{
  min-width:0;
  height:44px!important;
  max-height:88px;
  font-size:16px!important;
  border-radius:22px!important;
}
.input-row .btn-primary,#generateBtn{
  width:auto!important;
  min-width:92px;
  height:44px!important;
  margin:0!important;
  border-radius:22px!important;
  padding:0 16px!important;
  font-size:14px!important;
}
.reply-card-chat .rc-bubble{border-radius:14px;padding:12px 44px 12px 14px}
.reply-card-chat .rc-text{font-size:15px;line-height:1.55}
.floating-settings{
  left:calc(50% - min(50vw,var(--app-max)/2) + 14px);
  bottom:calc(var(--tab-h) + var(--safe-bottom) + 14px);
  width:46px;height:46px;
}
.overlay{padding:14px!important}.overlay-content,.payment-modal{width:100%!important;max-width:360px!important;max-height:calc(100dvh - 32px);overflow-y:auto}
img,canvas,video{max-width:100%;height:auto}
@media (max-width:767px){
  body{display:block;background:#fff}
  #app{max-width:none;box-shadow:none}
  .tab-bar{left:0;right:0;transform:none;max-width:none;border-radius:16px 16px 0 0}
  .floating-settings{left:14px}
}
@media (max-width:360px){
  .tab-label{font-size:9px}.tab-icon{font-size:17px}
  .input-row .btn-primary,#generateBtn{min-width:78px;padding:0 12px!important}
  .style-item,.handbook-cat,.handbook-topic{font-size:10px;padding:5px 8px}
}


/* Compact generate layout: move style up, remove center blank */
#page-generate .style-panel-mobile{
  flex-shrink:0;
  padding:8px 10px 6px;
  background:#fff;
  border-bottom:1px solid #F3F4F6;
}
#page-generate .style-panel-mobile .style-header{
  margin-bottom:4px!important;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
#page-generate .style-panel-mobile .input-label-s{
  font-size:12px;
  font-weight:700;
  color:#374151;
}
#page-generate .style-panel-mobile .sel-style{
  font-size:11px;
  color:#FF2D75;
}
#page-generate .style-panel-mobile .style-scroll-x{
  margin-bottom:0!important;
  max-height:72px!important;
  overflow-y:auto!important;
  flex-wrap:wrap!important;
  align-content:flex-start;
}
#replyArea{
  flex:0 1 auto!important;
  min-height:190px!important;
  max-height:calc(100dvh - 330px);
  padding-top:8px!important;
  padding-bottom:8px!important;
}
#replyEmpty{
  padding:18px 0!important;
}
#page-generate > div:last-of-type{
  padding-top:8px!important;
}
@media (max-width:767px){
  #replyArea{min-height:180px!important;max-height:calc(100dvh - 320px)}
  #page-generate .style-panel-mobile .style-scroll-x{max-height:68px!important}
}
@media (max-width:360px){
  #replyArea{min-height:150px!important;max-height:calc(100dvh - 300px)}
}


/* Tighten center area after moving style upward */
#replyArea{
  flex:1 1 auto!important;
  min-height:0!important;
  max-height:none!important;
  align-content:flex-start;
}
#replyCards{
  display:flex;
  flex-direction:column;
  gap:8px;
}
#replyCards:empty + *{display:none}
#replyEmpty{
  margin:0!important;
  padding:14px 0!important;
}
.reply-card-chat{margin-bottom:8px!important}
.refresh-btn{margin:2px 0 4px!important;padding:8px!important}

/* Final mobile generate layout: keep bottom input visible */
#page-generate.active{
  display:flex!important;
  flex-direction:column!important;
  height:calc(100dvh - var(--tab-h) - var(--safe-bottom))!important;
  max-height:calc(100dvh - var(--tab-h) - var(--safe-bottom))!important;
  overflow:hidden!important;
  padding:0!important;
}
#page-generate > div:first-of-type,
#page-generate .handbook-panel,
#page-generate .style-panel-mobile,
#page-generate .generate-input-bar{
  flex-shrink:0!important;
}
#replyArea{
  flex:1 1 auto!important;
  min-height:0!important;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  -webkit-overflow-scrolling:touch;
  padding:8px 10px!important;
}
.generate-input-bar{
  flex-shrink:0!important;
  position:relative!important;
  z-index:20!important;
  padding:8px 10px calc(10px + var(--safe-bottom))!important;
  border-top:1px solid #F3F4F6!important;
  background:rgba(250,250,250,.98)!important;
  backdrop-filter:blur(14px);
  box-shadow:0 -4px 18px rgba(15,23,42,.04);
}
.generate-input-bar .input-row{
  display:flex!important;
  align-items:flex-end!important;
  gap:8px!important;
  width:100%!important;
}
.generate-input-bar #contextInput{
  flex:1 1 auto!important;
  min-width:0!important;
  height:44px!important;
  max-height:88px!important;
  font-size:16px!important;
  border-radius:22px!important;
}
.generate-input-bar #generateBtn{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:94px!important;
  height:44px!important;
  margin:0!important;
  padding:0 16px!important;
  border-radius:22px!important;
  white-space:nowrap!important;
}
@media (max-width:360px){
  .generate-input-bar #generateBtn{min-width:80px!important;padding:0 12px!important;font-size:13px!important}
  .generate-input-bar #contextInput{font-size:15px!important}
}



/* Neutral toast: avoid green blank bar on copy */
.app-toast{
  position:fixed;
  left:50%;
  bottom:calc(var(--tab-h,64px) + var(--safe-bottom,0px) + 18px);
  transform:translate(-50%,10px) scale(.98);
  opacity:0;
  max-width:min(78vw,280px);
  padding:8px 14px;
  border-radius:999px;
  background:rgba(31,41,55,.92);
  color:#fff;
  font-size:13px;
  line-height:1.35;
  text-align:center;
  z-index:1200;
  box-shadow:0 8px 24px rgba(15,23,42,.18);
  pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
  white-space:nowrap;
}
.app-toast.show{opacity:1;transform:translate(-50%,0) scale(1)}

.auth-overlay{
  z-index:3000!important;
  background:rgba(15,23,42,.42)!important;
  backdrop-filter:blur(10px);
}
.auth-card{
  width:calc(100% - 34px)!important;
  max-width:360px!important;
  border-radius:22px!important;
  padding:22px 18px 18px!important;
  text-align:left;
}
.auth-logo{
  width:52px;
  height:52px;
  border-radius:18px;
  display:flex;
  align-items:center;
  justify-content:center;
  margin:0 auto 10px;
  background:linear-gradient(135deg,#ff6b9d,#c084fc);
  color:#fff;
  font-size:26px;
  box-shadow:0 8px 24px rgba(255,107,157,.28);
}
.auth-card h3{
  text-align:center;
  font-size:20px;
  color:var(--t);
  margin-bottom:4px;
}
.auth-subtitle{
  text-align:center;
  font-size:12px;
  color:var(--tl);
  margin-bottom:16px;
}
.auth-actions{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.auth-actions .btn-primary{
  margin-bottom:0!important;
}
.btn-secondary-auth{
  width:100%;
  border:1px solid var(--b);
  background:#fff;
  color:var(--p);
  border-radius:16px;
  padding:12px;
  font-size:14px;
  font-weight:700;
}
.auth-code-row{
  display:flex;
  align-items:center;
  gap:8px;
  width:100%;
}
.auth-code-row .text-input{
  flex:1 1 auto;
  min-width:0;
}
.auth-code-row .btn-secondary-auth{
  flex:0 0 118px;
  width:118px;
  height:46px;
  padding:0 8px;
  white-space:nowrap;
}
.auth-user{
  text-align:center;
  color:var(--tl);
  font-size:11px;
  margin-top:8px;
}

.sel-style.need-select{
  color:#fff!important;
  background:#ff2d75!important;
  padding:2px 8px;
  border-radius:999px;
  animation:shakeSelect .28s ease 0s 2;
}
@keyframes shakeSelect{
  0%,100%{transform:translateX(0)}
  35%{transform:translateX(-3px)}
  70%{transform:translateX(3px)}
}

/* Growth page form rows */
.invite-row{
  align-items:center;
  width:100%;
}
.invite-row .text-input{
  flex:1 1 auto!important;
  min-width:0!important;
  height:36px!important;
}
.invite-row .btn-primary{
  flex:0 0 auto!important;
  width:auto!important;
  min-width:92px!important;
  height:36px!important;
  padding:0 14px!important;
  margin:0!important;
  border-radius:18px!important;
  white-space:nowrap!important;
  font-size:12px!important;
}

/* Hard page switching guard: only one tab page is visible */
#app > .page{
  display:none!important;
}
#app > .page.active{
  display:flex!important;
}

/* Ensure generate controls are always visible */
#page-generate.active .handbook-panel,
#page-generate.active .style-panel-mobile,
#page-generate.active #handbookCats,
#page-generate.active #handbookTopics,
#page-generate.active #styleGrid{
  display:flex!important;
}
#page-generate.active .handbook-panel,
#page-generate.active .style-panel-mobile{
  flex-direction:column!important;
}
/* Final guard: generated replies must stay visible */
#page-generate.active #replyArea{
  display:block!important;
  flex:1 1 auto!important;
  min-height:120px!important;
  max-height:none!important;
  overflow-y:auto!important;
  padding:12px 16px!important;
  background:#FAFAFA!important;
}
#page-generate.active #replyCards{
  display:flex!important;
  flex-direction:column!important;
  gap:10px!important;
  width:100%!important;
  min-height:1px!important;
  visibility:visible!important;
  opacity:1!important;
}
#page-generate.active #replyCards .reply-card-chat{
  display:block!important;
  width:100%!important;
  visibility:visible!important;
  opacity:1!important;
  margin:0!important;
}
#page-generate.active #replyCards .rc-bubble,
#page-generate.active #replyCards .rc-text{
  display:block!important;
  visibility:visible!important;
  opacity:1!important;
}
#page-generate.active .generate-input-bar{
  display:block!important;
  flex-shrink:0!important;
}
#page-generate.active ~ .floating-settings,
.floating-settings{
  top:calc(var(--safe-top,0px) + 10px)!important;
  left:10px!important;
  bottom:auto!important;
  width:38px!important;
  height:38px!important;
  font-size:18px!important;
  z-index:120!important;
  opacity:.92;
}
#privacyFloat{
  top:calc(var(--safe-top,0px) + 12px)!important;
  right:10px!important;
  bottom:auto!important;
  z-index:120!important;
  font-size:10px!important;
  padding:3px 7px!important;
  opacity:.82;
}
.profile-card{background:var(--bg);padding:8px;border-radius:8px;text-align:center;display:flex;flex-direction:column;gap:3px}
.profile-card b{font-size:17px;color:var(--text)}
.profile-card span{font-size:10px;color:var(--tl)}
.profile-pill{background:var(--p);color:#fff;padding:3px 8px;border-radius:999px;font-size:11px}
.memory-empty{padding:10px;text-align:center;color:var(--tl)}
.memory-count{font-size:12px;color:var(--p);font-weight:700;margin-bottom:6px}
