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

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
}

html { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.logo-icon { font-size: 2rem; }

.logo h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.tagline {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
}

.header-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary);
}

.header-actions { display: flex; align-items: center; gap: 10px; }
.access-button {
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-light);
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    font: inherit;
    font-size: 0.75rem;
}
.access-button:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Tab Nav ===== */
.tab-nav {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    gap: 4px;
    overflow-x: auto;
}

.tab-btn {
    background: none;
    border: none;
    padding: 14px 20px;
    font-size: 0.9rem;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-icon { font-size: 1.1rem; }

/* ===== Main Content ===== */
.main {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.page-header { margin-bottom: 28px; }

.page-header h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.page-sub {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* ===== Card ===== */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px;
    margin-bottom: 20px;
}

.card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--card-bg);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea { resize: vertical; }

.form-hint {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 4px;
}

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

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

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

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

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

.btn-primary:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

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

.btn-secondary:hover { background: var(--border); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

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

.btn-block { width: 100%; }

/* ===== Profit Calculator Layout ===== */
.calc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

/* ===== Scoring / Gap Layout (same as calc) ===== */
.scoring-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

@media (max-width: 768px) {
    .calc-layout, .scoring-layout { grid-template-columns: 1fr; }
}

/* ===== Result Tables ===== */
.result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
}

.result-table th,
.result-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.result-table th {
    background: var(--bg);
    font-weight: 600;
    color: var(--text);
    font-size: 0.85rem;
}

.result-table td { color: var(--text); }

.result-table .total-row {
    background: var(--primary-light);
    font-weight: 700;
}

.result-table .total-row td { border-top: 2px solid var(--primary); }

.result-table .compare-best {
    background: #f0fdf4;
    font-weight: 600;
}

.cost-item { color: var(--danger); }

.profit-item { color: var(--success); }

/* ===== Verdict Badge ===== */
.verdict {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 700;
    margin: 12px 0;
}

.verdict-good { background: #d1fae5; color: #065f46; }
.verdict-caution { background: #fef3c7; color: #92400e; }
.verdict-bad { background: #fee2e2; color: #991b1b; }

/* ===== Score Cards ===== */
.score-overall {
    text-align: center;
    margin: 20px 0;
    padding: 24px;
    background: var(--primary-light);
    border-radius: var(--radius);
}

.score-overall .score-num {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
}

.score-overall .score-label {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 4px;
}

.score-dimensions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin: 20px 0;
}

@media (max-width: 600px) {
    .score-dimensions { grid-template-columns: 1fr; }
}

.score-dim {
    background: var(--bg);
    border-radius: 8px;
    padding: 16px;
    border-left: 4px solid var(--border);
}

.score-dim.dim-good { border-left-color: var(--success); }
.score-dim.dim-caution { border-left-color: var(--warning); }
.score-dim.dim-bad { border-left-color: var(--danger); }

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

.score-dim .dim-title { font-weight: 600; font-size: 0.9rem; }

.score-dim .dim-score {
    font-weight: 700;
    font-size: 1.3rem;
}

.dim-body { font-size: 0.85rem; color: var(--text-light); line-height: 1.5; }

/* ===== Platform Gap Table ===== */
.gap-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
}

.gap-table th,
.gap-table td {
    padding: 12px 14px;
    text-align: center;
    border: 1px solid var(--border);
}

.gap-table th {
    background: var(--bg);
    font-weight: 600;
}

.gap-table .platform-cell { font-weight: 600; text-align: left; }

.gap-table .status-hot { color: var(--danger); font-weight: 600; }
.gap-table .status-up { color: var(--warning); font-weight: 600; }
.gap-table .status-stable { color: var(--success); font-weight: 600; }

.gap-table .opp-good { background: #d1fae5; color: #065f46; font-weight: 600; }
.gap-table .opp-caution { background: #fef3c7; color: #92400e; font-weight: 600; }
.gap-table .opp-bad { background: #fee2e2; color: #991b1b; font-weight: 600; }

/* ===== Cross-platform Opportunity Radar ===== */
.radar-hero {
    padding: 20px;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
    margin-bottom: 18px;
}
.radar-eyebrow { font-size: 0.75rem; opacity: 0.75; letter-spacing: 0.08em; }
.radar-hero h3 { margin: 4px 0 6px; padding: 0; border: 0; color: white; }
.radar-hero p { font-size: 0.88rem; opacity: 0.9; }
.radar-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 20px; }
.radar-card { border: 1px solid var(--border); border-radius: 10px; padding: 15px; background: var(--card-bg); }
.radar-card.is-top { border-color: var(--success); box-shadow: 0 0 0 2px rgba(16,185,129,.1); }
.radar-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 12px; }
.radar-platform { font-weight: 700; }
.radar-badge { border-radius: 999px; padding: 3px 9px; font-size: 0.75rem; font-weight: 700; }
.radar-badge.good { color: #065f46; background: #d1fae5; }
.radar-badge.caution { color: #92400e; background: #fef3c7; }
.radar-badge.bad { color: #991b1b; background: #fee2e2; }
.radar-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radar-metric { padding: 8px; background: var(--bg); border-radius: 7px; }
.radar-metric span { display: block; color: var(--text-light); font-size: 0.72rem; }
.radar-metric strong { font-size: 0.86rem; }

.access-dialog { position: fixed; inset: 0; z-index: 1200; background: rgba(15,23,42,.58); display: flex; align-items: center; justify-content: center; padding: 20px; }
.access-dialog.hidden { display: none; }
.access-dialog-card { position: relative; width: min(420px, 100%); background: white; border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); }
.access-dialog-card h2 { text-align: center; margin-bottom: 8px; font-size: 1.25rem; }
.access-dialog-card > p { color: var(--text-light); font-size: .86rem; margin-bottom: 18px; }
.access-dialog-card label { display: block; font-weight: 600; font-size: .86rem; margin-bottom: 6px; }
.access-dialog-card input { width: 100%; border: 1.5px solid var(--border); border-radius: 8px; padding: 11px 13px; font-size: 1rem; margin-bottom: 4px; }
.access-dialog-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.access-dialog-icon { text-align: center; font-size: 2rem; }
.access-dialog-close { position: absolute; right: 14px; top: 10px; border: 0; background: none; font-size: 1.8rem; color: var(--text-light); cursor: pointer; }
.access-error { min-height: 24px; color: var(--danger); font-size: .8rem; }
.access-dialog-card .access-help { margin: 12px 0 0; text-align: center; font-size: .76rem; }

@media (max-width: 600px) {
    .header-actions .header-badge { display: none; }
    .radar-grid { grid-template-columns: 1fr; }
}

/* ===== Decision Guide ===== */
.guide-layout {
    max-width: 640px;
    margin: 0 auto;
}

.guide-step, .guide-result {
    transition: opacity 0.3s;
}

.guide-step.hidden, .guide-result.hidden {
    display: none;
}

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

.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.step-header h3 { margin: 0; border: none; padding: 0; }

.step-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .step-options { grid-template-columns: 1fr; }
}

.option-btn {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-family: inherit;
}

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

.option-btn strong {
    font-size: 1rem;
    color: var(--text);
}

.option-btn span {
    font-size: 0.82rem;
    color: var(--text-light);
}

.guide-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.guide-actions .btn { flex: 1; }

/* ===== Guide Result ===== */
.guide-result-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.guide-result-section:last-child { border-bottom: none; }

.guide-result-section h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 6px;
}

.guide-result-section p {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
}

.guide-result-section .highlight {
    color: var(--primary);
    font-weight: 600;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

.footer p { margin-bottom: 4px; }

.footer-meta { color: var(--text-light); opacity: 0.7; }

/* ===== Loading Overlay ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.hidden { display: none; }

.loading-box {
    background: white;
    padding: 32px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

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

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

.loading-box p { color: var(--text-light); font-size: 0.9rem; }

/* ===== AI Result Sections ===== */
.ai-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.ai-section:last-child { border-bottom: none; margin-bottom: 0; }

.ai-section h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.ai-section p, .ai-section li {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.7;
}

.ai-section ul {
    padding-left: 20px;
    margin-top: 6px;
}

.ai-section li { margin-bottom: 4px; }

/* ===== Strategy Box ===== */
.strategy-box {
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 16px 0;
}

.strategy-box h4 {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
}

.strategy-box p {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; gap: 8px; padding: 12px 16px; }
    .main { padding: 20px 16px; }
    .card { padding: 20px; }
    .form-row { flex-direction: column; }
    .page-header h2 { font-size: 1.3rem; }
    .partner-layout { grid-template-columns: 1fr !important; }
    .commission-level { flex-direction: column !important; text-align: center !important; }
}

/* ===== Partnership / Business Cooperation ===== */
.partner-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

.partner-rules { grid-column: 1 / -1; }

.commission-rule {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.commission-level {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg);
    border-radius: 10px;
}

.level-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    flex-shrink: 0;
}

.level-1 { background: var(--primary); }
.level-2 { background: #8b5cf6; }

.level-detail strong {
    display: block;
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 4px;
}

.level-detail p {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.5;
}

.level-detail .highlight {
    color: var(--success);
    font-weight: 700;
    font-size: 1.05rem;
}

.commission-arrow {
    text-align: center;
    font-size: 1.5rem;
    color: var(--text-light);
}

.commission-example {
    background: #eff6ff;
    border-radius: 10px;
    padding: 20px;
    margin-top: 20px;
}

.commission-example h4 {
    font-size: 0.95rem;
    color: var(--primary);
    margin-bottom: 10px;
}

.commission-example p {
    font-size: 0.88rem;
    color: var(--text);
    margin-bottom: 8px;
}

.commission-example ul {
    padding-left: 20px;
    margin-bottom: 10px;
}

.commission-example li {
    font-size: 0.88rem;
    color: var(--text);
    line-height: 1.8;
}

.commission-example strong {
    color: var(--success);
}

.example-note {
    font-size: 0.85rem !important;
    color: var(--text-light) !important;
    font-style: italic;
}

.partner-process { grid-column: 1; }

.process-steps {
    list-style: none;
    padding: 0;
    counter-reset: step;
}

.process-steps li {
    counter-increment: step;
    padding: 14px 0 14px 44px;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.process-steps li:last-child { border-bottom: none; }

.process-steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 14px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.process-steps strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
}

.process-steps span {
    font-size: 0.85rem;
    color: var(--text-light);
}

.partner-contact { grid-column: 2; }

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.contact-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.contact-item strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
}

.contact-item p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.qr-placeholder {
    margin-top: 8px;
}

.qr-code {
    width: 140px;
    height: 140px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    font-size: 0.82rem;
    background: var(--bg);
}

.qr-code small {
    font-size: 0.72rem;
    color: var(--text-light);
    opacity: 0.6;
    margin-top: 4px;
}

.qr-img {
    width: 160px;
    height: 160px;
    border-radius: 10px;
    border: 1px solid var(--border);
    object-fit: contain;
    background: #fff;
}

.partner-faq { grid-column: 1 / -1; }

.partner-faq details {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}

.partner-faq summary {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    padding: 4px 0;
}

.partner-faq summary:hover { color: var(--primary); }

.partner-faq details[open] p {
    font-size: 0.88rem;
    color: var(--text-light);
    line-height: 1.6;
    padding: 8px 0 4px 0;
    margin: 0;
}

/* ===== Partner (simplified) ===== */
.partner-simple {
    max-width: 420px;
    margin: 0 auto;
}
.partner-card-simple {
    text-align: center;
    padding: 40px 28px;
}
.partner-card-simple h3 {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 10px;
}
.partner-desc {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 24px;
}
.partner-card-simple .qr-img {
    width: 200px;
    height: 200px;
}
