/* ===== 全局样式 ===== */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --accent-color: #FFC107;
    --text-color: #333;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --shadow-strong: rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --success-color: #4CAF50;
    --warning-color: #FF9800;
    --danger-color: #F44336;
    --info-color: #2196F3;
}

/* 深色主题 */
[data-theme="dark"] {
    --primary-color: #66BB6A;
    --secondary-color: #5C6BC0;
    --accent-color: #FFB300;
    --text-color: #e0e0e0;
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.4);
    --shadow-strong: rgba(0, 0, 0, 0.5);
}

/* 护眼主题 */
[data-theme="eye-care"] {
    --primary-color: #7CB342;
    --secondary-color: #42A5F5;
    --accent-color: #FFB74D;
    --text-color: #546e7a;
    --bg-color: #f0f4c3;
    --card-bg: #ffffff;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.12);
    --shadow-strong: rgba(0, 0, 0, 0.16);
}

* {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, var(--bg-color) 0%, var(--bg-color) 100%);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    background-color: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px var(--shadow-medium);
    width: 90%;
    max-width: 900px;
    margin: 40px 0;
    text-align: center;
    animation: fadeIn 1s ease-out;
    position: relative;
}

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

/* ===== 标题 ===== */
h1 {
    font-size: 2.8em;
    color: var(--primary-color);
    margin-bottom: 25px;
    background: linear-gradient(45deg, var(--primary-color), #66BB6A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    letter-spacing: 1px;
    text-shadow: 1px 1px 2px var(--shadow-light);
}

/* ===== 主题切换器 ===== */
.theme-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
}

.theme-btn {
    background-color: var(--card-bg);
    border: 2px solid var(--shadow-medium);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px var(--shadow-light);
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 8px var(--shadow-medium);
}

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

/* ===== 内容区域 ===== */
.content-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.content-section.active {
    display: block;
}

/* ===== 输入组 ===== */
.input-group {
    margin-bottom: 20px;
    text-align: left;
    position: relative;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-color);
    font-size: 1.1em;
}

.input-field-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: inset 0 1px 3px var(--shadow-light);
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.input-field-wrapper:focus-within {
    border-color: var(--secondary-color);
}

.input-field-wrapper input[type="number"] {
    flex-grow: 1;
    padding: 15px;
    border: none;
    outline: none;
    font-size: 1.1em;
    background: transparent;
    color: var(--text-color);
}

.input-field-wrapper input[type="number"]:focus {
    outline: none;
}

/* 隐藏数字输入框的上下箭头 */
.input-field-wrapper input[type="number"]::-webkit-outer-spin-button,
.input-field-wrapper input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.input-field-wrapper input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* IE/Edge */
.input-field-wrapper input[type="number"]::-ms-clear {
    display: none;
}

.input-field-wrapper input[type="number"]::-ms-reveal {
    display: none;
}

.input-field-wrapper select {
    padding: 15px;
    border: none;
    background-color: var(--shadow-light);
    border-left: 1px solid var(--shadow-medium);
    outline: none;
    font-size: 1.1em;
    cursor: pointer;
    color: var(--text-color);
}

.error-message {
    color: var(--danger-color);
    font-size: 0.9em;
    margin-top: 5px;
    text-align: left;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ===== 按钮组 ===== */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.action-btn {
    background: linear-gradient(45deg, var(--secondary-color), #5C6BC0);
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px var(--shadow-medium);
    width: calc(50% - 8px);
    min-width: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px var(--shadow-strong);
}

.action-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 10px var(--shadow-light);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* 返回按钮 */
.back-btn {
    background: linear-gradient(45deg, var(--primary-color), #66BB6A);
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px var(--shadow-light);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-medium);
}

.back-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ===== 通用按钮样式 ===== */
button {
    font-family: inherit;
}

button:hover:not(:disabled),
.action-btn:hover:not(:disabled),
.back-btn:hover {
    background: linear-gradient(45deg, #5C6BC0, var(--secondary-color));
}

button:disabled,
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:focus,
.action-btn:focus,
.back-btn:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ===== 结果区域 ===== */
.result-section {
    margin-top: 30px;
    padding: 25px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px var(--shadow-light);
    border: 1px solid var(--primary-color);
    display: none;
    animation: slideInUp 0.6s ease-out forwards;
}

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

.result-section h2 {
    color: var(--primary-color);
    font-size: 2em;
    margin-bottom: 15px;
}

.result-section p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.bmi-value {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px var(--shadow-light);
}

.status-text {
    font-size: 1.5em;
    font-weight: bold;
    padding: 8px 15px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 10px;
    color: white;
    text-shadow: 0 1px 2px var(--shadow-medium);
}

.status-underweight { background-color: var(--accent-color); }
.status-normal { background-color: var(--success-color); }
.status-overweight { background-color: var(--warning-color); }
.status-obese { background-color: var(--danger-color); }

/* ===== BMI 图表 ===== */
.bmi-chart-container {
    width: 100%;
    height: 30px;
    background-color: var(--shadow-light);
    border-radius: 15px;
    margin: 20px auto;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 5px var(--shadow-light);
}

.bmi-chart-bar {
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    transition: width 0.8s ease-out, background-color 0.8s ease-out;
    border-radius: 15px;
}

.bmi-chart-indicator {
    position: absolute;
    top: -5px;
    width: 10px;
    height: 40px;
    background-color: var(--accent-color);
    border-radius: 5px;
    box-shadow: 0 2px 8px var(--shadow-medium);
    transform: translateX(-50%);
    transition: left 0.8s ease-out;
    z-index: 1;
}

.bmi-chart-label {
    position: absolute;
    top: 35px;
    font-size: 0.9em;
    color: var(--text-color);
    transform: translateX(-50%);
}

.bmi-range-marker {
    position: absolute;
    height: 100%;
    width: 2px;
    background-color: rgba(0, 0, 0, 0.3);
    top: 0;
    z-index: 0;
}
.bmi-range-marker.underweight { left: calc((18.5 - 10) / 30 * 100%); }
.bmi-range-marker.normal { left: calc((24 - 10) / 30 * 100%); }
.bmi-range-marker.overweight { left: calc((28 - 10) / 30 * 100%); }

/* ===== 信息和建议区域 ===== */
.info-section, .health-advice {
    margin-top: 40px;
    text-align: left;
    padding: 25px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px var(--shadow-light);
    animation: slideInUp 0.8s ease-out forwards;
    opacity: 0;
}

.info-section h3, .health-advice h3 {
    font-size: 1.8em;
    color: var(--secondary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li {
    margin-bottom: 10px;
    font-size: 1.1em;
    position: relative;
    padding-left: 25px;
}

.info-section ul li::before {
    content: '•';
    color: var(--primary-color);
    font-size: 1.2em;
    position: absolute;
    left: 0;
    top: 0;
}

.health-advice {
    background-color: rgba(33, 150, 243, 0.1);
    border: 1px solid var(--secondary-color);
}

.health-advice p {
    font-size: 1.1em;
    margin-bottom: 10px;
}

/* ===== 目标体重计算 ===== */
.target-weight-section {
    margin-top: 30px;
    padding: 25px;
    background-color: rgba(76, 175, 80, 0.05);
    border-radius: var(--border-radius);
    border: 1px solid var(--primary-color);
    text-align: left;
    display: none; /* 默认隐藏，计算后显示 */
}

.target-weight-section h3 {
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 15px;
}

.target-weight-item {
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    box-shadow: 0 2px 8px var(--shadow-light);
}

.target-weight-item h4 {
    margin: 0 0 10px 0;
    color: var(--secondary-color);
}

.target-weight-item p {
    margin: 5px 0;
    font-size: 1.1em;
}

/* ===== 历史记录 ===== */
.history-section {
    margin-top: 30px;
}

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

.history-list {
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: transform 0.2s ease;
}

.history-item:hover {
    transform: translateX(5px);
}

.history-item-info {
    flex: 1;
}

.history-item-date {
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.7;
    margin-bottom: 5px;
}

.history-item-details {
    font-size: 1.1em;
}

.history-item-bmi {
    font-weight: bold;
    color: var(--secondary-color);
}

.history-item-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    color: white;
    font-weight: bold;
}

.history-item-status.underweight { background-color: var(--accent-color); }
.history-item-status.normal { background-color: var(--success-color); }
.history-item-status.overweight { background-color: var(--warning-color); }
.history-item-status.obese { background-color: var(--danger-color); }

.history-item-actions {
    display: flex;
    gap: 10px;
}

.history-btn {
    padding: 8px 15px;
    font-size: 0.9em;
    max-width: none;
    margin: 0;
}

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

.history-btn.clear {
    background-color: var(--text-color);
    margin-left: 10px;
}

.empty-history {
    text-align: center;
    padding: 40px;
    color: var(--text-color);
    opacity: 0.7;
}

/* ===== 历史记录图表 ===== */
.history-chart-container {
    margin-top: 30px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 5px 15px var(--shadow-light);
}

.history-chart-container canvas {
    max-width: 100%;
}

/* ===== 导出按钮组 ===== */
.export-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.export-btn {
    padding: 12px 24px;
    font-size: 1em;
    max-width: none;
    width: auto;
    margin: 0;
}

.export-btn.pdf {
    background: linear-gradient(45deg, #f44336, #d32f2f);
}

.export-btn.image {
    background: linear-gradient(45deg, #9c27b0, #7b1fa2);
}

.export-btn.csv {
    background: linear-gradient(45deg, #4caf50, #388e3c);
}

/* ===== 快捷键提示 ===== */
.keyboard-hint {
    margin-top: 20px;
    padding: 15px;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    font-size: 0.9em;
    color: var(--text-color);
    opacity: 0.7;
}

.keyboard-hint kbd {
    background-color: var(--card-bg);
    border: 1px solid var(--shadow-medium);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
}

/* ===== 详细建议区域 ===== */
.detailed-advice {
    margin-top: 20px;
}

.advice-category {
    margin-bottom: 20px;
}

.advice-category h4 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.advice-list {
    list-style: none;
    padding: 0;
}

.advice-list li {
    padding: 10px 15px;
    background-color: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.advice-list li::before {
    content: '✓';
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.2em;
    flex-shrink: 0;
}

/* ===== 滚动动画 ===== */
.scroll-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== 响应式设计 ===== */

/* 超大屏幕 (1200px 及以上) */
@media (min-width: 1200px) {
    .container {
        max-width: 1000px;
        padding: 40px;
    }
    
    h1 {
        font-size: 3em;
    }
    
    .history-list {
        max-height: 500px;
    }
}

/* 大屏幕 (992px - 1199px) */
@media (max-width: 1199px) and (min-width: 992px) {
    .container {
        max-width: 950px;
    }
}

/* 平板横屏 (768px - 991px) */
@media (max-width: 991px) and (min-width: 768px) {
    .container {
        max-width: 700px;
        padding: 25px;
    }
    
    h1 {
        font-size: 2.4em;
    }
    
    .target-weight-item,
    .advice-list li {
        padding: 12px;
    }
}

/* 平板竖屏 (576px - 767px) */
@media (max-width: 767px) and (min-width: 576px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        margin: 20px 0;
        width: 95%;
    }
    
    h1 {
        font-size: 2.2em;
        margin-bottom: 20px;
    }
    
    .theme-switcher {
        top: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .theme-btn {
        padding: 6px 10px;
        font-size: 1em;
    }

    button {
        padding: 12px 25px;
        font-size: 1.1em;
        max-width: 100%;
    }
    
    .input-field-wrapper input,
    .input-field-wrapper select {
        padding: 12px;
        font-size: 1em;
    }

    .result-section h2 {
        font-size: 1.8em;
    }
    
    .bmi-value {
        font-size: 2em;
    }
    
    .status-text {
        font-size: 1.3em;
    }
    
    .bmi-chart-container {
        height: 28px;
        margin: 15px auto;
    }
    
    .info-section,
    .health-advice {
        padding: 20px;
        margin-top: 30px;
    }
    
    .info-section h3,
    .health-advice h3 {
        font-size: 1.6em;
    }
    
    .advice-category h4 {
        font-size: 1.1em;
    }
    
    .history-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
    }
    
    .history-item-date {
        font-size: 0.85em;
    }
    
    .history-item-details {
        font-size: 1em;
        flex-wrap: wrap;
    }
    
    .history-item-bmi {
        font-size: 1.2em;
    }
    
    .history-item-status {
        font-size: 0.85em;
        padding: 3px 8px;
        margin-top: 8px;
        display: inline-block;
    }
    
    .history-item-actions {
        width: 100%;
        margin-top: 12px;
        justify-content: flex-end;
    }
    
    .history-btn {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .export-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 1em;
    }

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

    .action-btn {
        width: 100%;
    }
    
    .keyboard-hint {
        font-size: 0.85em;
        padding: 12px;
    }
    
    .keyboard-hint kbd {
        padding: 2px 5px;
        font-size: 0.85em;
    }
}

/* 手机大屏 (480px - 575px) */
@media (max-width: 575px) and (min-width: 480px) {
    body {
        padding: 5px;
        align-items: flex-start;
    }
    
    .container {
        padding: 18px;
        margin: 15px 0;
        width: 96%;
        border-radius: 10px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 18px;
    }
    
    .theme-switcher {
        top: 8px;
        right: 8px;
    }
    
    .theme-btn {
        padding: 6px 9px;
        font-size: 0.9em;
    }
    
    .tabs {
        flex-direction: row;
        gap: 6px;
        margin-bottom: 15px;
    }

    .input-group {
        margin-bottom: 16px;
    }
    
    .input-group label {
        font-size: 1em;
        margin-bottom: 6px;
    }
    
    .input-field-wrapper {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-field-wrapper input {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        font-size: 1em;
        border-top: none;
        border-left: none;
    }

    .input-field-wrapper select {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        font-size: 1em;
        border-top: 1px solid var(--shadow-medium);
        border-left: none;
    }
    
    button {
        font-size: 1em;
        padding: 14px 20px;
        width: 100%;
        max-width: none;
        margin-top: 8px;
    }
    
    .result-section {
        padding: 20px;
        margin-top: 20px;
    }
    
    .result-section h2 {
        font-size: 1.6em;
        margin-bottom: 12px;
    }
    
    .result-section p {
        font-size: 1.1em;
    }
    
    .bmi-value {
        font-size: 1.8em;
    }
    
    .status-text {
        font-size: 1.2em;
        padding: 6px 12px;
    }
    
    .bmi-chart-container {
        height: 26px;
        margin: 15px auto;
    }
    
    .bmi-chart-label {
        font-size: 0.8em;
        top: 32px;
    }
    
    .target-weight-section {
        padding: 18px;
        margin-top: 20px;
    }
    
    .target-weight-section h3 {
        font-size: 1.3em;
        margin-bottom: 12px;
    }
    
    .target-weight-item {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .target-weight-item h4 {
        font-size: 1.1em;
        margin-bottom: 6px;
    }
    
    .target-weight-item p {
        font-size: 1em;
    }
    
    .health-advice,
    .info-section {
        padding: 18px;
        margin-top: 25px;
    }
    
    .health-advice h3,
    .info-section h3 {
        font-size: 1.4em;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .advice-category {
        margin-bottom: 16px;
    }
    
    .advice-category h4 {
        font-size: 1em;
        gap: 6px;
        margin-bottom: 8px;
    }
    
    .advice-list li {
        padding: 8px 12px;
        font-size: 0.95em;
        margin-bottom: 6px;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .history-header h3 {
        font-size: 1.4em;
        margin: 0;
    }
    
    .history-list {
        max-height: 350px;
    }
    
    .history-item {
        padding: 12px;
    }
    
    .history-item-date {
        font-size: 0.85em;
        margin-bottom: 4px;
    }
    
    .history-item-details {
        font-size: 0.95em;
        line-height: 1.5;
    }
    
    .history-item-bmi {
        font-size: 1.1em;
    }
    
    .history-item-status {
        font-size: 0.85em;
        padding: 2px 8px;
        margin: 6px 0 0 0;
    }
    
    .history-item-actions {
        margin-top: 10px;
    }
    
    .history-btn {
        padding: 8px 14px;
        font-size: 0.9em;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 15px;
    }
    
    .export-btn {
        width: 100%;
        padding: 12px 18px;
        font-size: 0.95em;
    }
    
    .keyboard-hint {
        font-size: 0.8em;
        padding: 10px;
        margin-top: 15px;
    }
    
    .keyboard-hint kbd {
        padding: 2px 4px;
        font-size: 0.8em;
    }
}

/* 手机小屏 (320px - 479px) */
@media (max-width: 479px) {
    body {
        padding: 0;
        min-height: 100vh;
    }
    
    .container {
        padding: 15px;
        margin: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
        padding-right: 80px;
    }
    
    .theme-switcher {
        top: 10px;
        right: 10px;
    }
    
    .theme-btn {
        padding: 5px 8px;
        font-size: 0.85em;
    }
    
    .tabs {
        flex-direction: row;
        gap: 5px;
        margin-bottom: 15px;
        width: 100%;
    }

    .input-group {
        margin-bottom: 15px;
    }
    
    .input-group label {
        font-size: 0.95em;
        margin-bottom: 6px;
    }
    
    .input-field-wrapper {
        flex-direction: column;
        align-items: stretch;
        border-radius: 8px;
    }
    
    .input-field-wrapper input {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        font-size: 1em;
        border: none;
        border-radius: 0;
    }
    
    .input-field-wrapper input:first-child {
        border-radius: 8px 8px 0 0;
    }

    .input-field-wrapper select {
        width: 100%;
        box-sizing: border-box;
        padding: 12px;
        font-size: 1em;
        border: none;
        border-top: 1px solid var(--shadow-medium);
        border-radius: 0 0 8px 8px;
    }
    
    button {
        font-size: 1em;
        padding: 14px 18px;
        width: 100%;
        max-width: none;
        margin-top: 8px;
        border-radius: 8px;
    }
    
    .error-message {
        font-size: 0.85em;
        margin-top: 4px;
    }
    
    .result-section {
        padding: 15px;
        margin-top: 18px;
        border-radius: 8px;
    }
    
    .result-section h2 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .result-section p {
        font-size: 1em;
        margin-bottom: 8px;
    }
    
    .bmi-value {
        font-size: 1.6em;
        margin-bottom: 8px;
    }
    
    .status-text {
        font-size: 1.1em;
        padding: 6px 12px;
        border-radius: 6px;
    }
    
    .bmi-chart-container {
        height: 24px;
        margin: 12px auto;
        border-radius: 12px;
    }
    
    .bmi-chart-indicator {
        width: 8px;
        height: 32px;
        top: -4px;
    }
    
    .bmi-chart-label {
        font-size: 0.75em;
        top: 30px;
    }
    
    .target-weight-section {
        padding: 15px;
        margin-top: 18px;
        border-radius: 8px;
    }
    
    .target-weight-section h3 {
        font-size: 1.2em;
        margin-bottom: 10px;
    }
    
    .target-weight-item {
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 8px;
    }
    
    .target-weight-item h4 {
        font-size: 1em;
        margin-bottom: 6px;
    }
    
    .target-weight-item p {
        font-size: 0.95em;
        margin: 4px 0;
    }
    
    .health-advice,
    .info-section {
        padding: 15px;
        margin-top: 20px;
        border-radius: 8px;
    }
    
    .health-advice h3,
    .info-section h3 {
        font-size: 1.3em;
        margin-bottom: 10px;
        padding-bottom: 8px;
    }
    
    .info-section ul li {
        font-size: 0.95em;
        padding-left: 20px;
        margin-bottom: 8px;
    }
    
    .health-advice p {
        font-size: 0.95em;
        margin-bottom: 8px;
    }
    
    .advice-category {
        margin-bottom: 15px;
    }
    
    .advice-category h4 {
        font-size: 0.95em;
        gap: 5px;
        margin-bottom: 6px;
    }
    
    .advice-list {
        padding: 0;
    }
    
    .advice-list li {
        padding: 8px 10px;
        font-size: 0.9em;
        margin-bottom: 5px;
        border-radius: 6px;
        line-height: 1.4;
    }
    
    .history-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .history-header h3 {
        font-size: 1.3em;
        margin: 0;
    }
    
    .history-btn.clear {
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    .history-list {
        max-height: 300px;
    }
    
    .history-item {
        padding: 10px;
        border-radius: 8px;
    }
    
    .history-item-date {
        font-size: 0.8em;
        margin-bottom: 4px;
        opacity: 0.6;
    }
    
    .history-item-details {
        font-size: 0.9em;
        line-height: 1.4;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .history-item-bmi {
        font-size: 1em;
    }
    
    .history-item-status {
        font-size: 0.8em;
        padding: 2px 6px;
        margin: 6px 0 0 0;
        border-radius: 10px;
    }
    
    .history-item-actions {
        margin-top: 8px;
    }
    
    .history-btn.delete {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    .empty-history {
        padding: 30px 15px;
        font-size: 0.95em;
    }
    
    .history-chart-container {
        margin-top: 15px;
        padding: 15px;
        border-radius: 8px;
    }
    
    .export-buttons {
        flex-direction: column;
        gap: 8px;
        margin-top: 12px;
    }
    
    .export-btn {
        width: 100%;
        padding: 12px 16px;
        font-size: 0.9em;
        border-radius: 8px;
    }
    
    .keyboard-hint {
        font-size: 0.75em;
        padding: 8px 10px;
        margin-top: 12px;
        border-radius: 8px;
    }
    
    .keyboard-hint kbd {
        padding: 1px 4px;
        font-size: 0.75em;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    button,
    .tab-btn,
    .theme-btn,
    .history-btn,
    .export-btn {
        min-height: 44px;
        min-width: 44px;
    }

    .history-item {
        padding: 15px;
    }
    
    .input-field-wrapper input,
    .input-field-wrapper select {
        padding: 14px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }
}

/* 横屏模式优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .container {
        margin: 10px auto;
        padding: 15px;
    }
    
    h1 {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .tabs {
        margin-bottom: 12px;
    }
    
    .input-group {
        margin-bottom: 12px;
    }
    
    button {
        margin-top: 5px;
        padding: 10px 20px;
    }
    
    .result-section {
        padding: 15px;
        margin-top: 15px;
    }
    
    .info-section,
    .health-advice {
        margin-top: 15px;
        padding: 15px;
    }
}

/* ===== 焦点样式（无障碍） ===== */
*:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* ===== 打印样式 ===== */
@media print {
    body {
        background: white;
    }
    .container {
        box-shadow: none;
        max-width: 100%;
    }
    .theme-switcher,
    .action-buttons,
    .back-btn,
    .history-item-actions,
    .export-buttons,
    .keyboard-hint {
        display: none !important;
    }
    .content-section {
        display: none !important;
    }
    #calculatorSection {
        display: block !important;
    }
}
