/* ========================================
   네이버 SEO 블로그 글 생성기 - 스타일시트
   ======================================== */

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

:root {
    --primary: #03C75A;
    --primary-dark: #02a34b;
    --primary-light: #e8f8ef;
    --accent: #1EC800;
    --bg: #f5f7fa;
    --bg-white: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #555;
    --text-muted: #999;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
}

/* Header */
#app-header {
    background: linear-gradient(135deg, #03C75A 0%, #00b350 50%, #009944 100%);
    color: white;
    padding: 40px 20px 36px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#app-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.08) 0%, transparent 60%);
    animation: headerGlow 8s ease-in-out infinite alternate;
}

@keyframes headerGlow {
    0% { transform: translate(0, 0); }
    100% { transform: translate(30px, -20px); }
}

.header-inner {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
    position: relative;
}

.header-actions {
    position: absolute;
    right: 0;
    display: flex;
    gap: 8px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 17px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-btn:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-2px);
}

/* 설정 버튼 상태 dot */
.settings-dot {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.8);
    display: none;
}
.settings-dot--ok {
    display: block;
    background: #4ade80;
}
.settings-dot--warn {
    display: block;
    background: #fbbf24;
}
.settings-dot--none {
    display: block;
    background: #f87171;
}

/* settings cog 회전 애니메이션 */
#settings-btn:hover .fa-cog {
    animation: cogSpin 0.6s ease-in-out;
}
@keyframes cogSpin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(90deg); }
}

.saved-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.logo i {
    font-size: 28px;
    background: rgba(255,255,255,0.2);
    padding: 12px;
    border-radius: 12px;
}

.logo h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.header-desc {
    font-size: 15px;
    opacity: 0.9;
    font-weight: 300;
}

/* Main */
#app-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 28px 16px 60px;
}

/* Card */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.step-badge {
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.result-badge {
    background: #10b981;
}

/* Topic Grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.topic-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.topic-btn i {
    font-size: 24px;
    color: var(--text-muted);
    transition: var(--transition);
}

.topic-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.topic-btn:hover i {
    color: var(--primary);
}

.topic-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(3, 199, 90, 0.35);
}

.topic-btn.active i {
    color: white;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    background: #fafbfc;
    transition: var(--transition);
    position: relative;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.01);
}

.upload-placeholder {
    text-align: center;
    padding: 40px 20px;
}

.upload-placeholder i {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.upload-main-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.upload-sub-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--primary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

/* Upload Counter */
.upload-counter {
    margin-left: auto;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg);
    padding: 4px 12px;
    border-radius: 20px;
}

.upload-counter.counter-active {
    color: var(--primary-dark);
    background: var(--primary-light);
}

/* Preview Grid (Multi-image) */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    padding: 14px;
    width: 100%;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border);
    background: #f8f9fa;
    transition: var(--transition);
}

.preview-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.preview-number {
    position: absolute;
    top: 6px;
    left: 6px;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    padding: 0 6px;
}

.preview-remove-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.55);
    color: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    opacity: 0;
}

.preview-item:hover .preview-remove-btn {
    opacity: 1;
}

.preview-remove-btn:hover {
    background: #ef4444;
    transform: scale(1.15);
}

/* Add more item in grid */
.preview-add-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    border: 2px dashed var(--border);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    background: #fafbfc;
}

.preview-add-item i {
    font-size: 24px;
}

.preview-add-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Upload Actions (add + clear) */
.upload-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    justify-content: center;
}

.upload-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

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

.upload-clear-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: 2px solid #fecaca;
    border-radius: var(--radius-sm);
    background: white;
    color: #ef4444;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.upload-clear-btn:hover {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* Text Input */
.text-input-wrap {
    position: relative;
}

.text-input-wrap textarea {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-primary);
    resize: vertical;
    transition: var(--transition);
    background: #fafbfc;
}

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

.text-input-wrap textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(3, 199, 90, 0.12);
}

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

/* API Key */
.api-key-wrap {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.api-key-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 13px;
    color: #1e40af;
}

.api-key-info a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.api-key-info a:hover {
    text-decoration: underline;
}

.api-input-group {
    display: flex;
    gap: 8px;
}

.api-input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
    background: #fafbfc;
}

.api-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(3, 199, 90, 0.12);
}

.toggle-key-btn {
    width: 46px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
}

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

/* Verify Button */
.verify-key-btn {
    padding: 0 18px;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.verify-key-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(3, 199, 90, 0.3);
}

.verify-key-btn:disabled {
    background: #cbd5e1;
    border-color: #cbd5e1;
    cursor: not-allowed;
}

/* Key Status */
.key-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    animation: fadeInUp 0.3s ease;
}

.key-status-icon {
    flex-shrink: 0;
    font-size: 16px;
}

.key-status-loading {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.key-status-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.key-status-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.key-status-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.save-key-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.save-key-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Generate Button */
.generate-wrap {
    text-align: center;
    padding: 16px 0 24px;
}

.generate-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 48px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #03C75A, #00a64e);
    color: white;
    font-family: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(3, 199, 90, 0.35);
}

.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(3, 199, 90, 0.45);
}

.generate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.generate-btn:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
}

.generate-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Loading */
.loading-content {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.spinner-ring {
    width: 56px;
    height: 56px;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 280px;
    margin: 0 auto;
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
    transition: var(--transition);
}

.loading-step.active {
    color: var(--primary);
    font-weight: 600;
}

.loading-step.done {
    color: #10b981;
}

.loading-step.done i::before {
    content: '\f058';
    font-weight: 900;
}

/* Result Section */
.result-block {
    margin-bottom: 24px;
}

.result-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.result-label span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-label-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.word-count {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    background: var(--bg);
    padding: 3px 10px;
    border-radius: 20px;
}

.copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

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

.copy-btn.copied {
    border-color: #10b981;
    color: #10b981;
    background: #ecfdf5;
}

/* ── Result Tabs ── */
.result-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.result-tab {
    flex: 1;
    padding: 13px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    position: relative;
}

.result-tab:hover {
    color: var(--primary);
    background: var(--primary-light);
}

.result-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: var(--primary-light);
}

.result-tab i {
    margin-right: 5px;
    font-size: 12px;
}

.result-tab-content {
    /* 탭 패널 컨테이너 */
}

.result-tab-panel {
    display: none;
}

.result-tab-panel.active {
    display: block;
}

@media (max-width: 640px) {
    .result-tab {
        font-size: 13px;
        padding: 11px 12px;
    }
}

.result-content {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

.title-content {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-color: #bbf7d0;
}

.body-content {
    max-height: 600px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Blog Table (본문 내 표) ── */
/* ── 블로그 표 공통 ── */
.body-content .blog-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 13.5px;
    line-height: 1.6;
    white-space: normal;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    table-layout: auto;
}

.body-content .blog-table th {
    padding: 10px 14px;
    font-weight: 600;
    text-align: left;
    font-size: 13px;
    letter-spacing: -0.2px;
    color: #fff;
}

.body-content .blog-table th:first-child {
    width: auto;
    white-space: nowrap;
}

.body-content .blog-table td {
    padding: 9px 14px;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-primary);
    vertical-align: top;
    word-break: keep-all;
}

.body-content .blog-table tbody tr {
    background: #fff;
    transition: background 0.15s;
}

.body-content .blog-table tbody tr:last-child td {
    border-bottom: none;
}

/* ── 글 A 표 — 녹색 ── */
.body-content .blog-table.blog-table--green thead tr {
    background: linear-gradient(135deg, #03C75A, #02b050);
}
.body-content .blog-table.blog-table--green th {
    border-bottom: 2px solid #02a049;
}
.body-content .blog-table.blog-table--green tbody tr:nth-child(even) {
    background: #f0faf4;
}
.body-content .blog-table.blog-table--green tbody tr:hover {
    background: #dcf8ea;
}
.body-content .blog-table.blog-table--green td:first-child {
    font-weight: 600;
    background: #e8f8ef;
    white-space: nowrap;
    border-right: 1px solid #b8edcc;
}

/* ── 글 B 표 — 파란색 ── */
.body-content .blog-table.blog-table--blue thead tr {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}
.body-content .blog-table.blog-table--blue th {
    border-bottom: 2px solid #1d4ed8;
}
.body-content .blog-table.blog-table--blue tbody tr:nth-child(even) {
    background: #eff6ff;
}
.body-content .blog-table.blog-table--blue tbody tr:hover {
    background: #dbeafe;
}
.body-content .blog-table.blog-table--blue td:first-child {
    font-weight: 600;
    background: #dbeafe;
    white-space: nowrap;
    border-right: 1px solid #bfdbfe;
}

/* ── 글 C 표 — 주황색 ── */
.body-content .blog-table.blog-table--orange thead tr {
    background: linear-gradient(135deg, #f97316, #ea6a00);
}
.body-content .blog-table.blog-table--orange th {
    border-bottom: 2px solid #c2540a;
}
.body-content .blog-table.blog-table--orange tbody tr:nth-child(even) {
    background: #fff7ed;
}
.body-content .blog-table.blog-table--orange tbody tr:hover {
    background: #ffedd5;
}
.body-content .blog-table.blog-table--orange td:first-child {
    font-weight: 600;
    background: #ffedd5;
    white-space: nowrap;
    border-right: 1px solid #fed7aa;
}

@media (max-width: 640px) {
    .body-content .blog-table {
        font-size: 12.5px;
        margin: 14px 0;
    }
    .body-content .blog-table th,
    .body-content .blog-table td {
        padding: 8px 10px;
    }
    .body-content .blog-table td:first-child {
        white-space: nowrap;
        min-width: auto;
    }
}

.tags-content {
    color: var(--primary-dark);
    font-weight: 500;
    background: var(--primary-light);
    border-color: #bbf7d0;
}

/* ── Score Card ── */
.score-card {
    background: linear-gradient(135deg, #f8fafc, #f0f9ff);
    border: 1px solid #e0e7ef;
    border-radius: var(--radius);
    padding: 28px;
    margin-top: 4px;
}

.score-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}

.score-circle {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border: 5px solid #cbd5e1;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transition: var(--transition);
}

.score-circle.grade-s { border-color: #10b981; }
.score-circle.grade-a { border-color: #03C75A; }
.score-circle.grade-b { border-color: #f59e0b; }
.score-circle.grade-c { border-color: #f97316; }
.score-circle.grade-d { border-color: #ef4444; }

.score-number {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.score-unit {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.score-grade {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Score Details */
.score-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.score-item {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

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

.score-item-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-item-label i {
    font-size: 13px;
    width: 18px;
    text-align: center;
    color: var(--text-muted);
}

.score-item-value {
    font-size: 16px;
    font-weight: 800;
}

.score-bar-bg {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Score Comment */
.score-comment {
    background: white;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
}

.score-comment i {
    color: var(--primary);
    margin-right: 4px;
}

/* Score responsive */
@media (max-width: 640px) {
    .score-card {
        padding: 20px 14px;
    }
    .score-circle {
        width: 90px;
        height: 90px;
    }
    .score-number {
        font-size: 28px;
    }
}

/* Full Copy */
.full-copy-wrap {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.full-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: 50px;
    background: var(--primary);
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(3, 199, 90, 0.3);
}

.full-copy-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: 2px solid var(--border);
    border-radius: 50px;
    background: white;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.retry-btn:hover {
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: #10b981;
}

.toast.error {
    background: #ef4444;
}

.toast.info {
    background: #3b82f6;
}

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Save Button */
.save-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 32px;
    border: 2px solid #f59e0b;
    border-radius: 50px;
    background: #f59e0b;
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.save-btn:hover {
    background: #d97706;
    border-color: #d97706;
    transform: translateY(-2px);
}

.save-btn.saved {
    background: #9ca3af;
    border-color: #9ca3af;
    cursor: default;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-box {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: modalIn 0.25s ease;
}

.modal-box-lg {
    max-width: 720px;
}

.modal-box-sm {
    max-width: 420px;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-close-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* Saved List */
.saved-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.saved-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.saved-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.saved-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.saved-item-info {
    flex: 1;
    min-width: 0;
}

.saved-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-item-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.saved-tab-badge {
    display: inline-flex;
    align-items: center;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 20px;
    border: 1px solid #b8edcc;
    letter-spacing: 0.02em;
}

.saved-item-delete {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.saved-item-delete:hover {
    background: #fef2f2;
    color: #ef4444;
}

/* Detail modal content */
.detail-section {
    margin-bottom: 20px;
}

.detail-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.detail-text {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 14px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.detail-title-text {
    font-size: 17px;
    font-weight: 700;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border-color: #bbf7d0;
}

.detail-tags-text {
    color: var(--primary-dark);
    font-weight: 500;
    background: var(--primary-light);
    border-color: #bbf7d0;
}

/* Modal responsive */
@media (max-width: 640px) {
    .modal-box {
        max-height: 90vh;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-footer {
        flex-direction: column;
    }
    .modal-footer button {
        width: 100%;
        justify-content: center;
    }
    .header-actions {
        position: static;
    }
    .header-top-row {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Footer */
#app-footer {
    text-align: center;
    padding: 30px 20px;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 640px) {
    #app-header {
        padding: 28px 16px 24px;
    }

    .logo h1 {
        font-size: 20px;
    }

    .logo i {
        font-size: 22px;
        padding: 10px;
    }

    .header-desc {
        font-size: 13px;
    }

    #app-main {
        padding: 16px 12px 40px;
    }

    .card {
        padding: 20px 16px;
        border-radius: var(--radius);
    }

    .topic-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .topic-btn {
        padding: 14px 8px;
        font-size: 12px;
    }

    .topic-btn i {
        font-size: 20px;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .preview-remove-btn {
        opacity: 1;
    }

    .upload-actions {
        flex-direction: row;
    }

    .generate-btn {
        padding: 14px 36px;
        font-size: 15px;
        width: 100%;
    }

    .full-copy-wrap {
        flex-direction: column;
    }

    .full-copy-btn,
    .retry-btn {
        width: 100%;
        justify-content: center;
    }

    .result-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    #toast-container {
        bottom: 16px;
        right: 16px;
        left: 16px;
    }
}

/* Scrollbar */
.body-content::-webkit-scrollbar {
    width: 6px;
}

.body-content::-webkit-scrollbar-track {
    background: transparent;
}

.body-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.body-content::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Animations */
.card {
    animation: fadeInUp 0.4s ease;
}

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