* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1a5f2a 0%, #2d8a3e 50%, #1a5f2a 100%);
    min-height: 100vh;
    color: #333;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    padding: 10px;
    padding-bottom: 80px;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #2c3e50, #34495e);
    color: white;
    padding: 15px;
    border-radius: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.header h1 {
    font-size: 22px;
    text-align: center;
}

.voice-selector select {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
}

.voice-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.voice-icon {
    font-size: 20px;
}

.voice-selector select {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
}

.voice-selector select option {
    background: #2c3e50;
    color: white;
}

/* 低功耗模式开关 */
.power-mode {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(145deg, #95a5a6, #7f8c8d);
    padding: 8px 15px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
}

.power-mode:hover {
    transform: scale(1.05);
}

.power-mode.active {
    background: linear-gradient(145deg, #27ae60, #2ecc71);
}

.power-icon {
    font-size: 24px;
}

.power-label {
    font-size: 14px;
    font-weight: bold;
    color: white;
}

.power-mode.active .power-icon {
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.wifi-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.wifi-icon {
    font-size: 18px;
}

.wifi-status.connected .wifi-icon {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 区域标题 */
section h2 {
    color: white;
    font-size: 16px;
    margin-bottom: 10px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* 语音播报区域 */
.voice-section {
    margin-bottom: 15px;
}

.voice-section h2 {
    font-size: 20px;
}

.voice-controls {
    background: white;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.voice-btn {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border: none;
    border-radius: 18px;
    padding: 18px 30px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.voice-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.voice-btn .voice-icon {
    font-size: 36px;
}

.voice-btn .voice-label {
    font-size: 15px;
    color: white;
    font-weight: bold;
}

.audio-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.audio-item {
    background: linear-gradient(145deg, #ecf0f1, #bdc3c7);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.audio-item:hover {
    background: linear-gradient(145deg, #3498db, #2980b9);
}

.audio-item:hover .audio-icon,
.audio-item:hover .audio-number {
    color: white;
}

.audio-item.playing {
    background: linear-gradient(145deg, #2ecc71, #27ae60);
}

.audio-item.playing .audio-icon,
.audio-item.playing .audio-number {
    color: white;
}

.audio-icon {
    font-size: 30px;
}

.audio-number {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

.audio-item .delete-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #e74c3c;
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    cursor: pointer;
    display: none;
}

.audio-item:hover .delete-btn {
    display: block;
}

.audio-empty {
    text-align: center;
    padding: 25px;
    color: #999;
    font-size: 15px;
}

/* 作物选择区域 */
.crop-section {
    margin-bottom: 15px;
}

.crop-section h2 {
    font-size: 20px;
}

.crop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.crop-btn {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border: none;
    border-radius: 18px;
    padding: 18px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.crop-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.2);
}

.crop-btn.active {
    background: linear-gradient(145deg, #4caf50, #45a049);
    color: white;
}

.crop-btn.active .crop-name {
    color: white;
}

.crop-icon {
    font-size: 40px;
}

.crop-name {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* 控制面板 */
.control-section {
    margin-bottom: 15px;
}

.control-section h2 {
    font-size: 20px;
}

.auto-control-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    padding: 10px 15px;
    border-radius: 12px;
    margin-bottom: 12px;
}

.auto-label {
    font-size: 15px;
    font-weight: bold;
    color: #333;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.control-card {
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border-radius: 18px;
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: all 0.3s;
}

.control-card.active {
    background: linear-gradient(145deg, #4caf50, #45a049);
}

.control-card.active .control-icon {
    transform: scale(1.1);
}

.control-card.active .control-label {
    color: white;
}

.control-icon {
    font-size: 36px;
    transition: transform 0.3s;
}

.control-label {
    font-size: 14px;
    font-weight: bold;
    color: #333;
}

/* 开关样式 */
.toggle-switch {
    width: 56px;
    height: 30px;
    background: #ccc;
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.toggle-switch.on {
    background: #4caf50;
}

.toggle-knob {
    width: 26px;
    height: 26px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toggle-switch.on .toggle-knob {
    left: 28px;
}

/* 定时区域 */
.timer-section {
    margin-bottom: 15px;
}

.timer-section h2 {
    font-size: 20px;
}

.timer-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.timer-card {
    background: linear-gradient(145deg, #3498db, #2980b9);
    border-radius: 18px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: white;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.timer-card[data-timer="water"] {
    background: linear-gradient(145deg, #3498db, #2980b9);
}

.timer-card[data-timer="vent"] {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
}

.timer-card[data-timer="light"] {
    background: linear-gradient(145deg, #f39c12, #e67e22);
}

.timer-icon {
    font-size: 36px;
}

.timer-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.timer-label {
    font-size: 15px;
    font-weight: bold;
}

.timer-value {
    font-size: 13px;
    opacity: 0.9;
}

.timer-set-btn {
    background: rgba(255,255,255,0.3);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.timer-set-btn:hover {
    background: rgba(255,255,255,0.5);
    transform: scale(1.1);
}

/* 图表区域 */
.chart-section {
    margin-bottom: 15px;
    background: white;
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

.chart-section h2 {
    font-size: 20px;
    color: #333;
}

.chart-container {
    height: 220px;
    margin-bottom: 12px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 25px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.legend-color {
    width: 25px;
    height: 5px;
    border-radius: 3px;
}

/* 历史记录 */
.history-section {
    margin-bottom: 15px;
}

.history-section h2 {
    font-size: 20px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.history-card {
    background: linear-gradient(145deg, #fff, #f0f0f0);
    border-radius: 18px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.history-icon {
    font-size: 36px;
}

.history-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.history-label {
    font-size: 13px;
    color: #666;
}

.history-value {
    font-size: 22px;
    font-weight: bold;
    color: #333;
}

.chart-container {
    height: 200px;
    margin-bottom: 10px;
}

.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
}

.legend-color {
    width: 20px;
    height: 4px;
    border-radius: 2px;
}

.legend-color.water {
    background: #3498db;
}

.legend-color.temp {
    background: #e74c3c;
}

.legend-color.recommend {
    background: #2ecc71;
    height: 2px;
    border-style: dashed;
}

.legend-color.recommend-water {
    background: #27ae60;
}

.legend-color.recommend-temp {
    background: #f39c12;
}

/* 历史记录 */
.history-section {
    margin-bottom: 15px;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.history-card {
    background: linear-gradient(145deg, #fff, #f0f0f0);
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.history-icon {
    font-size: 28px;
}

.history-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.history-label {
    font-size: 11px;
    color: #666;
}

.history-value {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 25px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-content h3 {
    margin-bottom: 20px;
    font-size: 22px;
    color: #333;
}

.modal-body {
    margin-bottom: 20px;
}

.time-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.time-picker label {
    font-size: 16px;
    color: #666;
}

.time-picker input {
    padding: 12px 18px;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-size: 18px;
    outline: none;
}

.modal-buttons {
    display: flex;
    gap: 18px;
    justify-content: center;
}

.modal-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 28px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-btn.cancel {
    background: #95a5a6;
    color: white;
}

.modal-btn.confirm {
    background: #4caf50;
    color: white;
}

.modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* 作物推荐弹窗 */
.crop-recommend-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.crop-recommend-modal.active {
    display: flex;
}

.recommend-info {
    background: #f5f5f5;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
    text-align: left;
}

.recommend-info p {
    margin-bottom: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 作物推荐弹窗扩展 */
.crop-modal-content {
    max-width: 340px;
}

.current-values {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 12px;
}

.current-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.current-item b {
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 5px;
}

.recommend-info {
    background: #f9f9f9;
    border-radius: 15px;
    padding: 15px;
    margin-bottom: 15px;
}

.recommend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 10px;
    background: white;
}

.recommend-item.warning {
    background: #fff3cd;
    border: 2px solid #ffc107;
}

.recommend-item.warning .item-icon {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.item-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.item-icon {
    font-size: 18px;
}

.item-value {
    font-weight: bold;
    color: #333;
}

.item-value.current {
    color: #e74c3c;
}

.item-value.recommended {
    color: #4caf50;
}

.recommend-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.action-btn {
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s;
}

.action-btn.heat {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: white;
}

.action-btn.cool {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
}

.action-btn.humidify {
    background: linear-gradient(145deg, #1abc9c, #16a085);
    color: white;
}

.action-btn.dehumidify {
    background: linear-gradient(145deg, #9b59b6, #8e44ad);
    color: white;
}

.action-btn:hover {
    transform: scale(1.05);
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.control-card.active .control-icon {
    animation: bounce 0.5s;
}

/* 活跃状态指示 */
.control-card.active::after {
    content: '';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 10px #4caf50;
}

/* 响应式设计 */
@media (max-width: 400px) {
    .control-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }
    
    .control-card {
        padding: 10px 5px;
    }
    
    .control-icon {
        font-size: 24px;
    }
    
    .control-label {
        font-size: 10px;
    }
    
    .toggle-switch {
        width: 40px;
        height: 22px;
    }
    
    .toggle-knob {
        width: 18px;
        height: 18px;
    }
    
    .toggle-switch.on .toggle-knob {
        left: 20px;
    }
}

/* 水流动画 */
@keyframes waterFlow {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.control-card.active[data-control="water"] .control-icon::after {
    content: '〰️';
    position: absolute;
    animation: waterFlow 0.5s infinite;
}

/* 通风动画 */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.control-card.active[data-control="vent"] .control-icon {
    animation: spin 2s linear infinite;
}

/* 定时弹窗扩展样式 */
.timer-modal-content {
    max-width: 360px;
}

.quick-times {
    margin-bottom: 15px;
}

.quick-label {
    font-size: 12px;
    color: #666;
    display: block;
    margin-bottom: 8px;
    text-align: left;
}

.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-btn {
    background: linear-gradient(145deg, #ecf0f1, #bdc3c7);
    border: none;
    border-radius: 15px;
    padding: 8px 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.quick-btn:hover {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    transform: scale(1.05);
}

.time-input-group {
    margin-bottom: 20px;
}

.time-input-group label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    text-align: left;
}

.time-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.time-input-wrapper input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 18px;
    text-align: center;
    letter-spacing: 2px;
}

.time-input-wrapper input:focus {
    border-color: #4caf50;
    outline: none;
}

.time-display {
    font-size: 24px;
    font-weight: bold;
    color: #4caf50;
    min-width: 60px;
}

/* 数字键盘 */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.key-btn {
    background: linear-gradient(145deg, #34495e, #2c3e50);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 8px rgba(0,0,0,0.2);
}

.key-btn:hover {
    background: linear-gradient(145deg, #4caf50, #45a049);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.key-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.key-btn[data-value="del"],
.key-btn[data-value="clear"] {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
}

.keypad-group {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ddd;
}

.keypad-label {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    text-align: left;
}

.input-hint {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
}

/* 低功耗模式遮罩 */
.low-power-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.low-power-overlay.active {
    display: flex;
}

.low-power-content {
    text-align: center;
    color: white;
}

.low-power-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: batteryPulse 2s infinite;
}

@keyframes batteryPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.low-power-title {
    font-size: 34px;
    font-weight: bold;
    margin-bottom: 25px;
}

.low-power-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 35px;
    font-size: 18px;
    opacity: 0.8;
}

.low-power-exit {
    background: linear-gradient(145deg, #4caf50, #45a049);
    border: none;
    color: white;
    padding: 18px 45px;
    border-radius: 35px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
}

.low-power-exit:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
}

/* 低功耗模式隐藏其他模块 */
.app.low-power-mode .voice-section,
.app.low-power-mode .crop-section,
.app.low-power-mode .control-section,
.app.low-power-mode .timer-section {
    display: none;
}