:root {
    --primary-color: #2196F3;
    --primary-dark: #1976D2;
    --secondary-color: #90CAF9;
    --background-color: #F5F5F5;
    --card-background: #FFFFFF;
    --text-color: #333333;
    --border-color: #E0E0E0;
    --success-color: #4CAF50;
    --danger-color: #F44336;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.calculator-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

.calculator-card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    padding: 1.5rem;
    width: 100%;
}

h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
}

h3 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: var(--text-color);
}

.toggle-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.grade-inputs {
    margin: 2rem 0;
}

.input-headers {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.input-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

input {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

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

.add-row-btn {
    width: 100%;
    padding: 0.8rem;
    background: var(--secondary-color);
    color: var(--text-color);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 1rem 0;
    transition: background 0.3s ease;
}

.target-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 200px;
}

.unit {
    font-size: 1rem;
    color: var(--text-color);
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin: 2rem 0;
}

.calculate-btn, .reset-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calculate-btn {
    background: var(--success-color);
    color: white;
    flex: 2;
}

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

.results-section {
    margin-top: 2rem;
}

.result-row {
    margin-bottom: 1.5rem;
}

.result-display {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.result-box {
    background: var(--background-color);
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calculation-box {
    height: 100px;
    width: 100%;
}

/* Hover effects */
.add-row-btn:hover {
    background: #81D4FA;
}

.calculate-btn:hover {
    background: #43A047;
}

.reset-btn:hover {
    background: #E53935;
}

/* Responsive design */
@media (max-width: 600px) {
    .calculator-card {
        padding: 1rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .input-headers {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }
}

/* 在现有CSS���尾添加 */

.invalid {
    border-color: var(--danger-color) !important;
    background-color: rgba(244, 67, 54, 0.1);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.8rem;
    margin-top: 0.25rem;
    position: absolute;
    transform: translateY(100%);
}

.input-row {
    position: relative;
    margin-bottom: 1.5rem;
}

.target-input {
    position: relative;
}

/* 添加新的样式 */
.grade-input-wrapper {
    position: relative;
    width: 100%;
}

.grade-input-wrapper select,
.grade-input-wrapper input {
    width: 100%;
    height: 100%;
}

.letter-input {
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

/* 修改结果显示区域样式 */
.results-section[data-grade-type="letters"] .result-row:not(.gpa-row) {
    display: none;
}

.gpa-row {
    display: none;
}

.results-section[data-grade-type="letters"] .gpa-row {
    display: block;
}

/* 添加总计行样式 */
.total-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
    padding: 0.5rem 0;
    font-weight: bold;
}

.total-row > div {
    background: var(--background-color);
    padding: 0.8rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    text-align: center;
}

/* 添加 Points 模式下的显示控制 */
.results-section[data-grade-type="points"] .result-row:not(.points-row) {
    display: none;
}

.results-section[data-grade-type="points"] .points-row {
    display: block;
}

.points-row {
    display: none;
}

/* 修改现有的容器样式 */
.calculator-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
    width: 100%;
}

.calculator-card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    padding: 1.5rem;
    width: 100%;
}

/* 修改输入区域的响应式布局 */
.input-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* 添加媒体查询，优化移动端布局 */
@media screen and (max-width: 768px) {
    .calculator-card {
        padding: 1rem;
        border-radius: 8px;
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* 调整按钮组布局 */
    .toggle-group {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        width: 100%;
    }

    .toggle-btn {
        width: 100%;
        padding: 0.5rem;
        font-size: 0.9rem;
    }

    /* 调整输入区域布局 */
    .input-headers span,
    .input-row input,
    .input-row select {
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    /* 调整结果显示区域 */
    .result-display {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .result-box {
        padding: 0.6rem;
        font-size: 0.9rem;
        min-height: 36px;
    }

    /* 调整操作按钮 */
    .action-buttons {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .calculate-btn,
    .reset-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    /* 调整目标成绩输入框 */
    .target-input {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .target-input input {
        flex: 1;
    }

    /* 保持总计行的布局一致 */
    .total-row {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 0.5rem;
        margin-top: 0.8rem;
    }

    /* 调整间距 */
    .grade-inputs,
    .decimal-places,
    .target-grade-section {
        margin-bottom: 1.5rem;
    }

    /* 确保添加行按钮样式一致 */
    .add-row-btn {
        width: 100%;
        padding: 0.8rem;
        font-size: 0.9rem;
        margin: 1rem 0;
    }
}

/* 更小屏幕的优化 */
@media screen and (max-width: 480px) {
    .calculator-container {
        margin: 1rem auto;
    }

    .input-row {
        gap: 0.5rem;
    }

    .toggle-btn,
    .input-headers span,
    .input-row input,
    .input-row select,
    .result-box {
        font-size: 0.85rem;
    }
}

/* 添加到现有的 CSS 文件末尾 */

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.site-header {
    background: var(--navy-blue, #14213D);
    padding: 1rem 0;
}

.site-header .logo {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    font-family: Arial, sans-serif;
}

.site-header .domain-suffix {
    color: var(--accent-green, #9FE870);
}

/* 移动端适配 */
@media screen and (max-width: 480px) {
    .site-header .logo {
        font-size: 1.5rem;
    }
}

/* Breadcrumb */
.breadcrumb {
    background: #f5f5f5;
    padding: 0.5rem 0;
    margin-bottom: 2rem;
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

/* Main Content Layout */
.content-wrapper {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2rem;
    margin-bottom: 3rem;
}

/* Other Tools Card */
.tools-card {
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
}

.tools-card h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.tools-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.tools-column a {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color 0.3s;
}

.tools-column a:hover {
    color: var(--primary-color);
}

.tools-categories {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.tools-categories a {
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Footer */
.site-footer {
    background: #f5f5f5;
    padding: 2rem 0;
    margin-top: 3rem;
}

/* Responsive Design */
@media screen and (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .tools-card {
        margin-top: 2rem;
    }
}

@media screen and (max-width: 480px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .tools-categories {
        justify-content: center;
    }
}

/* SEO Content Styles */
.seo-content {
    margin-top: 4rem;
    padding: 2rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Headings */
.seo-content h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    margin: 2.5rem 0 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #f0f0f0;
}

.seo-content h2:first-child {
    margin-top: 0;
}

.seo-content h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin: 2rem 0 1rem;
}

/* Paragraphs */
.seo-content p {
    color: #4a5568;
    line-height: 1.7;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

/* Lists */
.seo-content ul {
    padding-left: 1.5rem;
    margin: 1rem 0 1.5rem;
}

.seo-content li {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

/* Example Boxes */
.seo-content .example-box {
    background: #f8fafc;
    border-left: 4px solid var(--primary-color);
    padding: 1.5rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .seo-content {
        padding: 1.5rem;
        margin-top: 3rem;
    }

    .seo-content h2 {
        font-size: 1.6rem;
    }

    .seo-content h3 {
        font-size: 1.3rem;
    }

    .seo-content p,
    .seo-content li {
        font-size: 1rem;
    }
}

@media screen and (max-width: 480px) {
    .seo-content {
        padding: 1rem;
        margin-top: 2rem;
    }

    .seo-content h2 {
        font-size: 1.4rem;
    }

    .seo-content h3 {
        font-size: 1.2rem;
    }
}

/* Grade Scale Table Styles */
.grade-scale-section {
    margin: 3rem 0;
    padding: 2rem;
    background: var(--card-background);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.grade-scale-intro {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.grade-table-wrapper {
    overflow-x: auto;
}

.grade-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 1rem;
}

.grade-table th {
    background: var(--primary-color);
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 500;
}

.grade-table td {
    padding: 0.8rem 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
}

.grade-table tbody tr:nth-child(even) {
    background: #f8fafc;
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
    .grade-scale-section {
        padding: 1.5rem;
        margin: 2rem 0;
    }

    .grade-scale-intro {
        font-size: 1rem;
    }

    .grade-table {
        font-size: 0.9rem;
    }

    .grade-table th,
    .grade-table td {
        padding: 0.6rem;
    }
}

@media screen and (max-width: 480px) {
    .grade-scale-section {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .grade-table {
        font-size: 0.8rem;
    }
}