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

:root {
    --primary: #6C5CE7;
    --primary-light: #A29BFE;
    --primary-dark: #5A4BD1;
    --accent: #00B894;
    --accent-light: #55EFC4;
    --bg: #0F0F1A;
    --bg-card: #1A1A2E;
    --bg-input: #16213E;
    --text: #FFFFFF;
    --text-secondary: #B2BEC3;
    --text-muted: #636E72;
    --border: #2D3436;
    --danger: #E17055;
    --success: #00B894;
    --warning: #FDCB6E;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 70px;
}

.screen {
    display: none;
    flex-direction: column;
    flex: 1;
    padding: 20px;
    padding-bottom: 90px;
    animation: fadeIn 0.3s ease;
    position: relative;
    z-index: 1;
}

.screen.active {
    display: flex;
}

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.header-area {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    margin-bottom: 8px;
}

.header-area h1 {
    font-size: 24px;
    font-weight: 700;
}

.settings-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.settings-btn:hover {
    background: var(--primary);
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

h2 {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.subtext {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 28px;
    border-radius: var(--radius);
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: center;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
    transform: translateY(-1px);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #00a381);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-pro {
    background: linear-gradient(135deg, #FDCB6E, #E17055);
    color: #2D3436;
    font-weight: 700;
}

.btn-sm {
    padding: 10px 20px;
    font-size: 14px;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.btn-group .btn {
    flex: 1;
}

.text-link {
    color: var(--primary-light);
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    padding: 8px;
    background: none;
    border: none;
    font-family: inherit;
}

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

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.card h3 {
    margin-bottom: 6px;
}

.card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.4;
}

.card.pro-card {
    border-color: var(--warning);
    position: relative;
}

.card.pro-card::after {
    content: "PRO";
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #FDCB6E, #E17055);
    color: #2D3436;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 4px;
}
.card.pro-card.pro-unlocked {
    border-color: var(--primary);
}
.card.pro-card.pro-unlocked::after {
    display: none;
}
.pro-label-tag {
    font-weight: 400;
    opacity: 0.7;
}

.tag {
    display: inline-block;
    background: rgba(108, 92, 231, 0.2);
    color: var(--primary-light);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 16px;
}

.section-block {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.section-block h3 {
    color: var(--primary-light);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.section-block p, .section-block .content {
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.confidence-bar-wrapper {
    margin-top: 8px;
}

.confidence-bar {
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    border-radius: 4px;
    transition: width 0.8s ease;
}

.confidence-text {
    font-size: 13px;
    color: var(--text-secondary);
}

textarea, input[type="text"], input[type="password"], input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

textarea:focus, input:focus {
    outline: none;
    border-color: var(--primary);
}

textarea {
    min-height: 120px;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.option-btn {
    padding: 14px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.option-btn:hover {
    border-color: var(--primary);
}

.option-btn.selected {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.15);
    color: var(--primary-light);
}

.option-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.option-list .option-btn {
    text-align: left;
    padding: 16px;
}

.tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    z-index: 100;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
}

.tab-bar .tab {
    flex: 1;
    padding: 12px 0;
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    transition: color 0.2s;
    border: none;
    background: none;
    font-family: inherit;
}

.tab-bar .tab.active {
    color: var(--primary-light);
}

.tab-bar .tab-icon {
    display: block;
    font-size: 20px;
    margin-bottom: 4px;
}

.streak-display {
    text-align: center;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 24px;
}

.streak-number {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent);
}

.streak-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.9);
    z-index: 200;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-overlay.active {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

.loading-text {
    font-size: 16px;
    color: var(--text-secondary);
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 26, 0.85);
    z-index: 150;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px 40px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
}

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    z-index: 300;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 184, 148, 0.4);
}

.toast.error {
    background: var(--danger);
    box-shadow: 0 4px 20px rgba(225, 112, 85, 0.4);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.success-banner {
    background: rgba(0, 184, 148, 0.15);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 16px;
    color: var(--accent-light);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
}

.empty-state h2 {
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
}

.paywall-benefits {
    list-style: none;
    margin: 20px 0;
}

.paywall-benefits li {
    padding: 10px 0;
    font-size: 15px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.paywall-benefits li::before {
    content: "\2713";
    color: var(--accent);
    font-weight: 700;
    font-size: 16px;
}

.paywall-price {
    text-align: center;
    margin: 20px 0 8px;
}

.paywall-price .price-amount {
    font-size: 40px;
    font-weight: 800;
    color: var(--text);
}

.paywall-price .price-label {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.paywall-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 16px;
}

.paywall-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 16px;
}

.video-list-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}

.video-list-item h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.video-list-item .source-tag {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.video-list-item .date {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-list {
    list-style: none;
}

.settings-list li {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.settings-list li:hover {
    background: rgba(108, 92, 231, 0.1);
}

.settings-list li span {
    font-size: 15px;
}

.settings-list li .arrow {
    color: var(--text-muted);
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary-light);
    font-size: 15px;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 16px;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 6px;
}

.generate-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    gap: 12px;
    padding: 40px 0;
}

.generate-center .btn-primary {
    width: auto;
    padding: 18px 48px;
    font-size: 18px;
    border-radius: 50px;
    animation: pulse 2s infinite;
}

.onboarding-progress {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
}

.progress-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

.progress-dot.done {
    background: var(--accent);
}

.account-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.account-info .info-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.account-info .info-row:last-child {
    border-bottom: none;
}

.account-info .info-label {
    color: var(--text-muted);
    font-size: 14px;
}

.account-info .info-value {
    font-weight: 600;
    font-size: 14px;
}

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.posting-detail p {
    margin-bottom: 6px;
}

.posting-detail strong {
    color: var(--primary-light);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

select {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    appearance: none;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
}

.schedule-option {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 10px;
}

.schedule-option h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.schedule-option p {
    color: var(--text-secondary);
    font-size: 14px;
}

.format-selector {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
}

.format-btn {
    padding: 10px 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.format-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.format-btn:hover {
    border-color: var(--primary-light);
}

.text-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.text-input:focus {
    border-color: var(--primary);
}

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

.result-section {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.result-section-header h3 {
    color: var(--primary-light);
    font-size: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.result-field {
    margin-bottom: 10px;
}

.field-label {
    display: block;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
}

.field-content {
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.btn-copy {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: var(--primary);
    color: white;
}

.btn-copy.copied {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

@media (max-width: 480px) {
    .app-container {
        max-width: 100%;
    }
    .tab-bar {
        max-width: 100%;
    }
}

.auth-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.auth-form {
    max-width: 360px;
    margin: 24px auto 0;
    width: 100%;
}

.auth-form input {
    margin-bottom: 12px;
    box-sizing: border-box;
}

.auth-form input[type="password"] {
    margin-bottom: 16px;
}

.auth-form .btn {
    width: 100%;
}

.auth-toggle {
    margin-top: 16px;
    color: var(--text-muted);
    font-size: 14px;
}

.auth-toggle a {
    color: var(--primary-light);
    text-decoration: none;
}

.auth-skip {
    margin-top: 12px;
}

.auth-skip a {
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.user-top-bar {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 90;
}

body.has-top-bar .app-container {
    padding-top: 48px;
}

.user-top-email {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.user-top-logout {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 400px) {
    .auth-form {
        max-width: 100%;
        padding: 0 4px;
    }

    .user-top-bar {
        padding: 6px 10px;
        gap: 8px;
    }

    .user-top-email {
        font-size: 12px;
    }
}
