html {
    font-size: 10px;
}

:root {
    --bg-page: #ffffff;
    --card-bg: #f5f7fb;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-light: #eef2f6;
    --accent: #cd1818;
    --accent-hover: #a51414;
    --btn-default: #334155;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 2px rgba(0, 0, 0, 0.03);
    --radius-card: 0;
    --radius-btn: 20px;
    --header-height: 7rem;
}

body {
    font-size: 1.6rem;
    background: var(--bg-page);
    margin: 0;
    padding-top: var(--header-height);
}

.dashboard {
    margin: 0 auto;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stock-card {
    flex: 1.1;
    min-width: 260px;
    background: var(--bg-page);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    overflow: hidden;
    align-self: flex-start;
    position: sticky;
    top: calc(var(--header-height));
    z-index: 10;
}

.main-panel {
    flex: 2.2;
    min-width: 260px;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.answer-area {
    border-radius: var(--radius-card);
    border: 1px solid var(--border-light);
    overflow: visible;
    display: flex;
    flex-direction: column;
}

.answer-header {
    padding: 1.1rem 2rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: left;
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 2rem;
    border-bottom: 1px solid var(--border-light);
    gap: 1rem;
}

.stock-title {
    flex: 0 0 auto;
}

.stock-search {
    flex-shrink: 0;
}

.search-wrapper {
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 4rem;
    padding: 0.5rem 0.2rem 0.5rem 1.2rem;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    width: 24rem;
}

.search-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(205, 24, 24, 0.1);
}

.search-wrapper #stockCodeInput {
    border: none;
    outline: none;
    flex: 1;
    font-size: 1.5rem;
    padding: 0.6rem 0;
    background: transparent;
    min-width: 100px;
}

.search-wrapper .search-btn {
    border: none;
    border-radius: 4rem;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-size: 1.6rem;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    margin-left: 0.5rem;
    line-height: 1;
}

.search-wrapper .search-btn:hover {
    background: var(--accent-hover);
}

.toggle-icon {
    display: none;
    float: right;
    font-size: 1.2rem;
    transition: transform 0.2s ease;
    color: var(--text-secondary);
}

.stock-header.open .toggle-icon {
    transform: rotate(180deg);
}

.stock-details {
    padding: 1rem 1.6rem 1.6rem 1.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: all 0.2s ease-in-out;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 1.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border-light);
}

.info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.info-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
}

.positive {
    color: #e53e3e;
    font-weight: 600;
}

.negative {
    color: #10b981;
    font-weight: 600;
}

.badge {
    background: #fee2e2;
    color: var(--accent);
    border-radius: 30px;
    padding: 0.2rem 1.2rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.button-group {
    background: white;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.6rem;
    position: sticky;
    top: calc(var(--header-height));
    z-index: 10;
    border-bottom: 1px solid var(--border-light);
    border-radius: var(--radius-card);
}

.analyst-btn {
    background: var(--card-bg);
    border: none;
    color: var(--btn-default);
    font-weight: 500;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-btn);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    font-size: 1.5rem;
}

.analyst-btn.active {
    background: var(--accent);
    box-shadow: 0 2px 6px rgba(205, 24, 24, 0.2);
    color: white;
}

.analyst-btn:hover {
    background: var(--accent);
    transform: translateY(-1px);
    color: white;
}

.analyst-btn.active:hover {
    background: var(--accent-hover);
}

.analyst-btn:active {
    color: white;
    transform: translateY(1px);
}

.answer-content {
    padding: 1.6rem 2rem;
    min-height: 53.8rem;
    max-height: none;
    overflow-y: visible;
    line-height: 1.65;
    font-size: 1.4rem;
    color: var(--text-primary);
    background: var(--card-bg);
}

.answer-content::-webkit-scrollbar {
    display: none;
}

.answer-content h1 {
    font-size: 2.4rem;
    margin: 1.2em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

.answer-content h2 {
    font-size: 2rem;
    margin: 1.2em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
    border-left: 3px solid var(--accent);
    padding-left: 1.4rem;
}

.answer-content h3 {
    font-size: 1.8rem;
    margin: 1.2em 0 0.5em;
    font-weight: 600;
    line-height: 1.3;
}

.answer-content h4, .answer-content h5, .answer-content h6 {
    font-size: 1.6rem;
    margin: 1em 0 0.5em;
    font-weight: 600;
}

.answer-content p {
    margin: 0.8em 0;
}

.answer-content ul, .answer-content ol {
    margin: 0.6em 0 0.6em 1.8em;
    padding-left: 0;
}

.answer-content li {
    margin: 0.3em 0;
}

.answer-content code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: monospace;
}

.answer-content pre {
    background: #f8fafc;
    padding: 1.4rem;
    border-radius: 1.4rem;
    overflow-x: auto;
    margin: 1.2em 0;
    border: 1px solid #eef2f6;
}

.answer-content pre code {
    background: transparent;
    padding: 0;
    font-size: 1.3rem;
}

.answer-content blockquote {
    border-left: 3px solid var(--accent);
    margin: 1em 0;
    padding-left: 1.2em;
    color: #475569;
    background: #fefaf5;
    border-radius: 0 1.2rem 1.2rem 0;
    font-style: normal;
}

.answer-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.2em 0;
    font-size: 1.3rem;
}

.answer-content th, .answer-content td {
    border: 1px solid #e2e8f0;
    padding: 0.8rem 1rem;
    text-align: left;
}

.answer-content th {
    background: #f8fafc;
    font-weight: 600;
}

.answer-content hr {
    margin: 2rem 0;
    border: none;
    border-top: 1px solid var(--border-light);
}

.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    padding: 6rem 2rem;
    color: #64748b;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 2.5px solid #e2e8f0;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.error-box {
    background: #fff5f5;
    color: #b91c1c;
    padding: 1.8rem;
    border-radius: 1.6rem;
    border-left: 4px solid var(--accent);
}

@media (max-width: 768px) {
    body {
        padding: 1.6rem;
        padding-top: calc(var(--header-height) + 1rem);
    }
    .stock-details-wrapper.collapsed {
        display: none;
    }
    .dashboard {
        flex-direction: column;
        gap: 2rem;
    }

    .stock-card,
    .button-group {
        position: static;
        top: auto;
    }

    .stock-card {
        width: 100%;
        position: sticky;
        top: 5.5rem;
        z-index: 12;
    }

    .stock-header {
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .toggle-icon {
        display: inline-block;
    }

    .stock-details.collapsed {
        display: none;
    }

    .button-group {
        padding: 1.2rem 2rem;
        gap: 1rem;
    }

    .analyst-btn {
        padding: 0.8rem 1rem;
        font-size: 1.5rem;
        flex: 1 1 calc(50% - 10px);
    }

    .answer-content {
        padding: 1.2rem 1.6rem;
    }

    .stock-header h2 {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .analyst-btn {
        flex: 1 1 100%;
    }

    .stock-details {
        padding: 1.2rem 2rem 2rem;
    }
}

.stock-details-wrapper.collapsed {
    display: none;
}
.toggle-icon {
    transition: transform 0.2s;
    padding: 1rem 1.5rem;
    font-size: 18px;
}
.stock-header.open .toggle-icon {
    transform: rotate(180deg);
}

/* 分页控件 */
.stock-details-wrapper {
    display: flex;
    flex-direction: column;
}

.pagination-scroll {
    display: flex;
    gap: 0.8rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    scrollbar-width: thin;
    justify-content: center;
}
.pagination-scroll::-webkit-scrollbar {
    height: 4px;
}

.pagination-scroll::-webkit-scrollbar-track {
    background: #eef2f6;
    border-radius: 2px;
}

.pagination-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.page-btn {
    min-width: 3rem;
    height: 2rem;
    padding: 0 0.8rem;
    border: 1px solid var(--border-light);
    background: white;
    border-radius: 2rem;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.page-btn.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.page-btn:hover:not(.active) {
    background: #f1f5f9;
}