/* ==========================================================================
   快乐农场 - 田地系统 (farm.css)
   ========================================================================== */

/* ==========================================================================
   1. 天气卡片与田地容器 (Weather + Grid)
   ========================================================================== */

.farm-weather-panel {
    width: min(1100px, 100%);
    margin: 0 auto 22px auto;
    padding: 18px 22px;
    border-radius: 24px;
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 18px;
    color: #213547;
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow: 0 18px 40px rgba(28, 40, 51, 0.14);
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
}

.farm-weather-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.6), transparent 38%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08));
    pointer-events: none;
}

.farm-weather-main,
.farm-weather-side {
    position: relative;
    z-index: 1;
}

.farm-weather-main {
    flex: 1;
    min-width: 0;
}

.farm-weather-kicker {
    font-size: 0.72em;
    letter-spacing: 0.22em;
    color: rgba(33, 53, 71, 0.6);
    margin-bottom: 8px;
}

.farm-weather-title {
    font-size: clamp(1.4rem, 2vw, 2rem);
    font-weight: 800;
    color: #16324f;
    margin-bottom: 6px;
}

.farm-weather-desc {
    font-size: 0.96rem;
    line-height: 1.55;
    color: rgba(22, 50, 79, 0.84);
    max-width: 38rem;
}

.farm-weather-side {
    min-width: 250px;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.farm-weather-effect-label {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(22, 50, 79, 0.56);
    margin-bottom: 8px;
}

.farm-weather-effect {
    font-size: 1.02rem;
    font-weight: 800;
    color: #0f3057;
    margin-bottom: 10px;
}

.farm-weather-note {
    font-size: 0.82rem;
    line-height: 1.5;
    color: rgba(22, 50, 79, 0.72);
}

.farm-weather-recommend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.recommend-label,
.weather-forecast-title {
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: rgba(22, 50, 79, 0.58);
}

.recommend-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.weather-crop-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #14324f;
    font-weight: 800;
    font-size: 0.84rem;
}

.weather-crop-chip .pixel-icon {
    width: 24px;
    height: 24px;
    margin: 0;
}

.weather-forecast {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(22, 50, 79, 0.12);
}

.weather-forecast-title {
    margin-bottom: 8px;
}

.forecast-item {
    display: grid;
    grid-template-columns: 3.5em 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    padding: 6px 0;
    color: rgba(22, 50, 79, 0.8);
}

.forecast-weather {
    font-weight: 800;
}

.forecast-accuracy {
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    font-size: 0.76rem;
    font-weight: 800;
}

.farm-weather-panel.weather-sunny {
    background: linear-gradient(135deg, rgba(255, 244, 204, 0.95), rgba(255, 226, 128, 0.88));
}

.farm-weather-panel.weather-rainy {
    background: linear-gradient(135deg, rgba(201, 232, 246, 0.96), rgba(145, 197, 224, 0.9));
}

.farm-weather-panel.weather-cloudy {
    background: linear-gradient(135deg, rgba(232, 238, 235, 0.96), rgba(190, 211, 205, 0.9));
}

.farm-weather-panel.weather-storm {
    color: #eef7ff;
    background: linear-gradient(135deg, rgba(60, 89, 119, 0.96), rgba(35, 54, 78, 0.92));
}

.farm-weather-panel.weather-storm .farm-weather-title,
.farm-weather-panel.weather-storm .farm-weather-desc,
.farm-weather-panel.weather-storm .farm-weather-effect,
.farm-weather-panel.weather-storm .farm-weather-note,
.farm-weather-panel.weather-storm .forecast-item,
.farm-weather-panel.weather-storm .recommend-label,
.farm-weather-panel.weather-storm .weather-forecast-title,
.farm-weather-panel.weather-storm .farm-weather-kicker,
.farm-weather-panel.weather-storm .farm-weather-effect-label {
    color: rgba(244, 249, 255, 0.92);
}

.farm-weather-panel.weather-storm .farm-weather-side,
.farm-weather-panel.weather-storm .weather-crop-chip,
.farm-weather-panel.weather-storm .forecast-accuracy {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.2);
}

.farm-weather-panel.weather-heatwave {
    background: linear-gradient(135deg, rgba(255, 224, 191, 0.96), rgba(255, 168, 102, 0.9));
}

.farm-weather-panel.weather-cold {
    background: linear-gradient(135deg, rgba(224, 240, 255, 0.96), rgba(182, 221, 255, 0.92));
}

.farm-weather-panel.weather-windy {
    background: linear-gradient(135deg, rgba(222, 239, 229, 0.96), rgba(166, 213, 189, 0.9));
}

.farm-weather-panel.weather-rainbow {
    background:
        linear-gradient(135deg, rgba(255, 242, 204, 0.94), rgba(214, 238, 255, 0.9)),
        linear-gradient(90deg, rgba(255, 121, 121, 0.22), rgba(255, 218, 121, 0.22), rgba(117, 209, 130, 0.22), rgba(116, 185, 255, 0.22));
}

#section-fields::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.35s ease;
}

#section-fields > h1,
#section-fields .game-content-wrapper {
    position: relative;
    z-index: 1;
}

body.weather-rainy #section-fields::before,
body.weather-storm #section-fields::before {
    opacity: 1;
    background: repeating-linear-gradient(
        105deg,
        rgba(200, 232, 246, 0.22) 0,
        rgba(200, 232, 246, 0.22) 2px,
        transparent 2px,
        transparent 13px
    );
    animation: weather-rain 0.9s linear infinite;
}

body.weather-storm #section-fields::before {
    opacity: 0.75;
    background:
        linear-gradient(rgba(22, 33, 51, 0.2), rgba(22, 33, 51, 0.2)),
        repeating-linear-gradient(105deg, rgba(218, 239, 255, 0.28) 0, rgba(218, 239, 255, 0.28) 3px, transparent 3px, transparent 12px);
}

body.weather-heatwave #section-fields::before {
    opacity: 0.55;
    background: linear-gradient(180deg, rgba(255, 179, 102, 0.16), rgba(255, 246, 214, 0.08));
    animation: heat-shimmer 2.8s ease-in-out infinite alternate;
}

body.weather-cold #section-fields::before {
    opacity: 0.7;
    background:
        linear-gradient(135deg, rgba(231, 246, 255, 0.24), rgba(255, 255, 255, 0.06)),
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0, rgba(255, 255, 255, 0.16) 1px, transparent 1px, transparent 18px);
}

body.weather-rainbow #section-fields::before {
    opacity: 0.55;
    background: linear-gradient(110deg, rgba(255, 214, 102, 0.14), rgba(116, 185, 255, 0.16), rgba(162, 155, 254, 0.12));
}

@keyframes weather-rain {
    from { background-position: 0 0; }
    to { background-position: 0 36px; }
}

@keyframes heat-shimmer {
    from { transform: translateY(0); filter: saturate(1); }
    to { transform: translateY(-6px); filter: saturate(1.2); }
}

/* 田地容器优化 - 拟物风格 */
#fields-container {
    /* 尺寸控制：保证够大 */
    width: 100%;           
    max-width: 1100px;     
    
    /* 容器居中：让盒子在页面居中 */
    margin: 0 auto;        
    box-sizing: border-box;
    
    padding: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    
    /* Grid 布局 & 内部居中 */
    display: grid !important; 
    /* 使用 minmax 保证格子既有底线宽度，又能拉伸 */
    grid-template-columns: repeat(5, minmax(100px, 1fr)); 
    /* 强制网格内容在容器内水平居中 */
    justify-content: center; 
    gap: 20px; 
}

/* 专注模式下，田地容器高亮覆盖 */
body.focus-mode #fields-container {
    margin-top: 10vh; /* 垂直居中一点 */
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 60px rgba(111, 66, 193, 0.2); /* 紫色光晕呼应专注按钮 */
    border: 2px solid rgba(111, 66, 193, 0.1);
}

body.focus-mode .farm-weather-panel {
    background: linear-gradient(135deg, rgba(250, 245, 255, 0.92), rgba(232, 222, 255, 0.82));
    border-color: rgba(111, 66, 193, 0.2);
    box-shadow: 0 0 45px rgba(111, 66, 193, 0.15);
}

/* ==========================================================================
   2. 单个土块基础与交互 (Field Block)
   ========================================================================== */

/* 单个土块优化 - 拟物风格 */
.field {
    /* 强制正方形比例 1:1 */
    aspect-ratio: 1 / 1; 
    width: 100%; 
    
    /* 内容绝对居中 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    border-radius: 16px; 
    
    /* 伪3D效果 */
    background-color: #e3d5ca; 
    border: none; 
    border-bottom: 6px solid #cbb8a5; /* 底部厚度 */
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    
    font-weight: bold;
    color: #8d7b68;
    position: relative; 
    
    transform: translateY(0);
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.field:hover {
    transform: translateY(-4px); 
    box-shadow: 0 15px 25px rgba(0,0,0,0.15);
}

/* 点击时的按压感 (Active) */
.field:active {
    transform: translateY(2px);
    border-bottom-width: 2px; 
    margin-top: 4px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 拖拽交互高亮 */
.field.drag-over {
    border: 3px dashed #28a745 !important;
    background-color: #e8f5e9 !important;
    transform: scale(1.05);
}

/* ==========================================================================
   3. 土块状态特化 (Field States)
   ========================================================================== */

/* 锁定状态 (Locked) */
.field.locked {
    background-color: #e0e0e0;
    border: 2px dashed #ccc;
    color: #999;
    cursor: not-allowed;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2em;
}
.field.locked::after {
    content: "🔒";
    opacity: 0.5;
}

/* 空闲状态 (Empty) */
.field.empty {
    background-color: #f0e6d2;
    border-style: solid;
    color: #8d7b68;
}
.field.empty:hover {
    background-color: #e6dac8;
    border-color: #a08c74;
}

/* 生长中状态 (Growing) */
.field.growing {
    background-color: #d4edda; 
    border-color: #c3e6cb;
    border-bottom-color: #a8dba8;
    border-style: solid;
    cursor: default;
    color: #155724; 
}

/* 成熟状态 (Ready) */
.field.ready {
    background-color: #fff3cd; 
    border-color: #ffeeba;
    border-bottom-color: #ffeeba;
    border-style: solid;
    font-weight: bold;
    color: #856404;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6); /* 发光特效 */
    /* 核心修复：完美融合脉冲呼吸与上下跳动 */
    animation: pulse 2s infinite, bounce 1s infinite alternate; 
}
.field.ready:hover {
    background-color: #ffe8a1;
    cursor: pointer;
}

.field.weather-pref-good {
    border-left: 5px solid #36a269;
    box-shadow: 0 0 18px rgba(54, 162, 105, 0.22);
}

.field.weather-pref-bad {
    border-left: 5px solid #d46b4f;
    box-shadow: 0 0 18px rgba(212, 107, 79, 0.22);
}

.field.field-weather-rainy,
.field.field-weather-storm {
    background-image: linear-gradient(180deg, rgba(133, 190, 215, 0.24), transparent);
}

.field.field-weather-heatwave {
    background-image: linear-gradient(180deg, rgba(255, 172, 92, 0.24), transparent);
}

.field.field-weather-cold {
    background-image: linear-gradient(180deg, rgba(214, 240, 255, 0.46), transparent);
}

.field.field-weather-rainbow {
    box-shadow: 0 0 22px rgba(255, 204, 92, 0.35), 0 0 14px rgba(116, 185, 255, 0.22);
}

/* 枯萎状态 (Withered) */
.field.withered {
    background-color: #d7ccc8;
    border-color: #bcaaa4;
    border-bottom-color: #8d6e63;
    border-style: solid;
    color: #5d4037;
    box-shadow: 0 0 12px rgba(93, 64, 55, 0.18);
}
.field.withered:hover {
    background-color: #d0c1bc;
    cursor: pointer;
}

/* 专属动画：成熟跳动 */
@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-4px); }
}

/* 双倍产出加成徽章 (Boosted) */
.field.boosted {
    border: 3px solid #ffd700; 
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4); 
    background-color: #fffdf0;
}
.field.boosted::after {
    content: "⚡️" attr(data-yield-label);
    position: absolute;
    top: 5px;
    right: 5px;
    background: #ffd700;
    color: #333;
    font-size: 0.7em;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   4. 田地衍生功能 (Harvest All Button)
   ========================================================================== */

#harvest-all-btn {
    display: none; /* 默认隐藏，由 JS 控制 */
    margin: 30px auto 0 auto; /* 居中并与上方网格保持距离 */
    padding: 12px 60px;
    
    /* 字体样式 */
    font-size: 1.4em;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    color: #5d4037; /* 深褐色字体，对比度高 */
    
    /* 拟物化按钮背景 - 金黄色渐变 */
    background: linear-gradient(to bottom, #ffeb3b 0%, #fbc02d 100%);
    border: 2px solid #f57f17;
    border-radius: 50px; /* 胶囊形状 */
    
    /* 3D 按压效果阴影 */
    box-shadow: 
        0 6px 0 #f57f17,          /* 底部厚度 */
        0 15px 20px rgba(0,0,0,0.2); /* 投影 */
    
    cursor: pointer;
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 出现动画 */
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#harvest-all-btn:hover {
    background: linear-gradient(to bottom, #fff176 0%, #fbc02d 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 8px 0 #f57f17,
        0 20px 25px rgba(0,0,0,0.25);
}

#harvest-all-btn:active {
    transform: translateY(6px); /* 按下去 */
    box-shadow: 
        0 0 0 #f57f17, /* 阴影消失 */
        0 2px 5px rgba(0,0,0,0.2);
}

/* 按钮专属弹出动画 */
@keyframes popIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
    .farm-weather-panel {
        flex-direction: column;
        padding: 16px 18px;
    }

    .farm-weather-side {
        min-width: 0;
    }
}
