/* ============================================================
   开心农场 2.5D - 样式表
   配色:土黄 + 草绿 + 橙色(QQ农场风)
   ============================================================ */

/* ===== 全局重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Microsoft YaHei", "微软雅黑", "PingFang SC", sans-serif;
}

body {
    background: linear-gradient(to bottom, #87CEEB 0%, #B0E0E6 35%, #C5E8A0 60%, #7CB342 100%);
    min-height: 100vh;
    overflow-x: hidden;
    user-select: none;
}

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============================================================
   登录 / 注册页
   ============================================================ */
.auth-page {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(to bottom, #6EC1E4 0%, #A3D9F5 45%, #BEE8A0 70%, #8BC34A 100%);
    z-index: 1;
}

.auth-bg { position: absolute; inset: 0; pointer-events: none; }

.sun {
    position: absolute;
    top: 50px; right: 12%;
    width: 90px; height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, #FFF59D, #FFD54F 60%, #FFB300);
    box-shadow: 0 0 60px rgba(255,193,7,0.7);
    animation: sunPulse 4s ease-in-out infinite;
}
@keyframes sunPulse {
    0%,100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.cloud {
    position: absolute;
    background: #fff;
    border-radius: 50px;
    opacity: 0.9;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08));
}
.cloud::before, .cloud::after {
    content: ""; position: absolute; background: #fff; border-radius: 50%;
}
.cloud1 { width: 120px; height: 36px; top: 80px; left: -130px; animation: cloudMove 40s linear infinite; }
.cloud1::before { width: 50px; height: 50px; top: -22px; left: 18px; }
.cloud1::after  { width: 40px; height: 40px; top: -16px; left: 60px; }
.cloud2 { width: 90px; height: 28px; top: 160px; left: -100px; animation: cloudMove 55s linear infinite; animation-delay: -20s; opacity: 0.8; }
.cloud2::before { width: 40px; height: 40px; top: -18px; left: 12px; }
.cloud2::after  { width: 32px; height: 32px; top: -12px; left: 44px; }
.cloud3 { width: 140px; height: 40px; top: 230px; left: -160px; animation: cloudMove 70s linear infinite; animation-delay: -35s; }
.cloud3::before { width: 56px; height: 56px; top: -26px; left: 24px; }
.cloud3::after  { width: 44px; height: 44px; top: -18px; left: 72px; }
@keyframes cloudMove {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(100vw + 200px)); }
}

.hill {
    position: absolute;
    bottom: -40px;
    border-radius: 50% 50% 0 0;
}
.hill1 { left: -10%; width: 60%; height: 220px; background: linear-gradient(to bottom, #9CCC65, #689F38); }
.hill2 { right: -10%; width: 55%; height: 180px; background: linear-gradient(to bottom, #AED581, #7CB342); }

.fence {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background:
        repeating-linear-gradient(90deg, #8D6E63 0 8px, transparent 8px 60px),
        linear-gradient(to bottom, transparent 0 20px, #6D4C41 20px 24px, transparent 24px 40px, #6D4C41 40px 44px, transparent 44px 60px);
    opacity: 0.85;
}

.auth-card {
    position: relative;
    z-index: 2;
    background: linear-gradient(to bottom, #FFFDE7, #FFF8E1);
    border: 5px solid #8B4513;
    border-radius: 24px;
    padding: 32px 36px 28px;
    width: 340px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.3), inset 0 0 0 2px rgba(255,255,255,0.6);
    text-align: center;
    animation: cardPop 0.5s cubic-bezier(.2,1.4,.5,1);
}
@keyframes cardPop {
    0% { transform: scale(0.6) translateY(40px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.auth-logo {
    font-size: 30px;
    font-weight: 900;
    color: #FF8C00;
    text-shadow: 2px 2px 0 #fff, 3px 3px 0 #8B4513;
    letter-spacing: 2px;
}
.auth-sub { font-size: 12px; color: #8D6E63; margin: 6px 0 18px; }

.auth-card h2 {
    color: #5D3A1F;
    font-size: 22px;
    margin-bottom: 16px;
}

.input-wrap {
    position: relative;
    margin-bottom: 14px;
}
.input-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}
.input-wrap input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 2px solid #D7B375;
    border-radius: 12px;
    font-size: 15px;
    background: #fff;
    transition: all 0.2s;
    outline: none;
}
.input-wrap input:focus {
    border-color: #FF8C00;
    box-shadow: 0 0 0 3px rgba(255,140,0,0.2);
}

.auth-submit {
    width: 100%;
    padding: 12px;
    margin-top: 6px;
    background: linear-gradient(to bottom, #FFB74D, #FF8C00);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 4px;
    box-shadow: 0 4px 0 #E65100, 0 6px 12px rgba(0,0,0,0.2);
    transition: all 0.15s;
}
.auth-submit:hover { transform: translateY(-2px); box-shadow: 0 6px 0 #E65100, 0 8px 14px rgba(0,0,0,0.25); }
.auth-submit:active { transform: translateY(2px); box-shadow: 0 2px 0 #E65100; }

.auth-switch {
    margin-top: 16px;
    font-size: 13px;
    color: #8D6E63;
}
.auth-switch a {
    color: #FF8C00;
    font-weight: bold;
    margin-left: 6px;
    text-decoration: none;
}
.auth-switch a:hover { text-decoration: underline; }

/* ============================================================
   顶部状态栏
   ============================================================ */
.top-bar {
    background: linear-gradient(to right, #8B4513, #A0522D 50%, #8B4513);
    color: #fff;
    padding: 10px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.35);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
}

.player-info { display: flex; align-items: center; gap: 12px; }

.avatar {
    width: 50px; height: 50px;
    background: radial-gradient(circle at 35% 35%, #FFE082, #FFCA28);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    border: 3px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.player-stats { display: flex; flex-direction: column; gap: 4px; }
.player-name { font-size: 15px; font-weight: bold; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.level-badge {
    background: linear-gradient(to bottom, #FFD54F, #FFA000);
    color: #5D3A1F;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid #fff;
    font-weight: bold;
}
.member-badge {
    background: linear-gradient(to bottom, #CE93D8, #8E24AA);
    color: #fff;
    font-size: 11px;
    padding: 1px 8px;
    border-radius: 10px;
    border: 1px solid #fff;
    font-weight: bold;
}

.stats-row { display: flex; gap: 10px; font-size: 13px; }
.stat {
    background: rgba(0,0,0,0.3);
    padding: 3px 10px;
    border-radius: 12px;
}

.top-buttons { display: flex; gap: 7px; flex-wrap: wrap; }

.btn-icon {
    background: linear-gradient(to bottom, #FFB74D, #FF8C00);
    color: #fff;
    border: 2px solid #fff;
    padding: 7px 12px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.btn-icon:hover { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,0.4); }
.btn-icon:active { transform: translateY(0); }
.btn-icon.danger { background: linear-gradient(to bottom, #EF5350, #C62828); }

/* ============================================================
   公告滚动条
   ============================================================ */
.announcement-bar {
    background: linear-gradient(to right, #FFF8E1, #FFE0B2, #FFF8E1);
    border-bottom: 2px solid #8B4513;
    padding: 6px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #5D3A1F;
    overflow: hidden;
}
.announce-icon { font-size: 16px; flex-shrink: 0; }
.announce-scroll-wrap { flex: 1; overflow: hidden; }
.announce-scroll {
    white-space: nowrap;
    font-weight: bold;
}
.announce-scroll.scroll-anim {
    display: inline-block;
    animation: scrollText 22s linear infinite;
    padding-left: 100%;
}
@keyframes scrollText {
    from { transform: translateX(0); }
    to { transform: translateX(-100%); }
}
.announce-more {
    background: rgba(139,69,19,0.15);
    border: 1px solid #8B4513;
    color: #5D3A1F;
    border-radius: 10px;
    padding: 2px 10px;
    font-size: 12px;
    flex-shrink: 0;
}
.announce-more:hover { background: #FFD54F; }

/* ============================================================
   主区域布局
   ============================================================ */
.game-area {
    display: grid;
    grid-template-columns: 1fr 330px;
    gap: 14px;
    padding: 14px;
    max-width: 1500px;
    margin: 0 auto;
    align-items: start;
}

/* ===== 农场区 ===== */
.farm-section {
    background: linear-gradient(to bottom, #6B4226, #5D3A1F);
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
    border: 4px solid #4A2C12;
}

.farm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    color: #fff;
}
.farm-header h2 { font-size: 20px; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }
.weather-info {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 12px;
}

/* ============================================================
   2.5D 农场核心
   ============================================================ */
.farm-scene {
    position: relative;
    height: 560px;
    perspective: 1400px;
    perspective-origin: 50% 25%;
    overflow: hidden;
    border-radius: 12px;
    background:
        radial-gradient(ellipse at 50% 90%, rgba(0,0,0,0.35), transparent 60%),
        linear-gradient(to bottom, #C5E8A0 0%, #9CCC65 45%, #8BC34A 75%, #7CB342 100%);
}

/* 草地纹理点缀 */
.farm-scene::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 12% 80%, rgba(255,255,255,0.25) 0 2px, transparent 2px),
        radial-gradient(circle at 80% 88%, rgba(255,255,255,0.2) 0 2px, transparent 2px),
        radial-gradient(circle at 30% 92%, rgba(255,255,255,0.2) 0 2px, transparent 2px),
        radial-gradient(circle at 65% 82%, rgba(255,255,255,0.2) 0 2px, transparent 2px);
    pointer-events: none;
}

.farm-board {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 470px;
    height: 350px;
    transform: translate(-50%, -55%) rotateX(55deg) rotateZ(-45deg);
    transform-style: preserve-3d;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
}

/* 单块农田(带厚度的土块) */
.plot {
    position: relative;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: filter 0.2s;
}

/* 土块顶面 */
.plot-top {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background:
        radial-gradient(ellipse at 30% 25%, #A1887F 0%, #8D6E63 40%, #6D4C41 100%);
    border: 2px solid #4E342E;
    /* 用多重 box-shadow 模拟土块厚度 */
    box-shadow:
        0 4px 0 #6D4C41,
        0 6px 0 #5D4037,
        0 8px 0 #4E342E,
        0 10px 0 #3E2723,
        0 14px 18px rgba(0,0,0,0.45);
    overflow: visible;
}
/* 土壤纹理(犁过的垄) */
.plot-top::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 6px;
    background:
        repeating-linear-gradient(55deg, rgba(0,0,0,0.12) 0 3px, transparent 3px 8px),
        radial-gradient(ellipse at 50% 50%, rgba(255,255,255,0.08), transparent 70%);
}

.plot.empty .plot-top {
    background: radial-gradient(ellipse at 30% 25%, #BCAAA4 0%, #A1887F 40%, #8D6E63 100%);
}

.plot:hover .plot-top {
    filter: brightness(1.15);
}
.plot:hover { filter: drop-shadow(0 0 10px rgba(255,215,0,0.7)); }

/* 浇水后土壤变深 */
.plot.watered .plot-top {
    background: radial-gradient(ellipse at 30% 25%, #6D4C41 0%, #5D4037 40%, #4E342E 100%);
}
/* 干燥土壤发白 */
.plot.dry .plot-top {
    background: radial-gradient(ellipse at 30% 25%, #D7CCC8 0%, #BCAAA4 40%, #A1887F 100%);
}

/* 作物(浮在土块上,反向旋转始终面向相机,translateZ 避免被后排 plot 遮挡) */
.plot-crop {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -65%) translateZ(25px) rotateZ(45deg) rotateX(-55deg);
    font-size: 38px;
    line-height: 1;
    filter: drop-shadow(2px 4px 3px rgba(0,0,0,0.45));
    pointer-events: none;
    z-index: 2;
    transition: font-size 0.4s;
}
.plot-crop.stage-seed { font-size: 16px; opacity: 0.7; }
.plot-crop.stage-growing { font-size: 24px; opacity: 0.9; animation: growSway 2.5s ease-in-out infinite; }
@keyframes growSway {
    0%,100% { transform: translate(-50%, -65%) translateZ(25px) rotateZ(45deg) rotateX(-55deg) rotate(-3deg); }
    50% { transform: translate(-50%, -65%) translateZ(25px) rotateZ(45deg) rotateX(-55deg) rotate(3deg); }
}

/* 成熟作物发光呼吸 */
.plot.ready .plot-top {
    box-shadow:
        0 4px 0 #6D4C41, 0 6px 0 #5D4037, 0 8px 0 #4E342E, 0 10px 0 #3E2723,
        0 0 22px rgba(255,215,0,0.8),
        0 14px 18px rgba(0,0,0,0.45);
    animation: readyGlow 1.6s ease-in-out infinite;
}
.plot.ready .plot-crop {
    animation: readyBob 1.6s ease-in-out infinite;
}
@keyframes readyGlow {
    0%,100% { filter: brightness(1); }
    50% { filter: brightness(1.25); }
}
@keyframes readyBob {
    0%,100% { transform: translate(-50%, -65%) translateZ(25px) rotateZ(45deg) rotateX(-55deg) scale(1); }
    50% { transform: translate(-50%, -72%) translateZ(25px) rotateZ(45deg) rotateX(-55deg) scale(1.08); }
}

/* 状态图标(杂草/害虫/缺水) */
.plot-status {
    position: absolute;
    transform: translateZ(20px) rotateZ(45deg) rotateX(-55deg);
    font-size: 18px;
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(1px 2px 2px rgba(0,0,0,0.5));
}
.plot-status.weed { top: 6px; right: 6px; animation: iconShake 1.6s infinite; }
.plot-status.pest { top: 6px; left: 6px; animation: iconShake 1.6s infinite; }
.plot-status.dry { bottom: 6px; right: 6px; }
@keyframes iconShake {
    0%,100% { transform: translateZ(20px) rotateZ(45deg) rotateX(-55deg) rotate(-12deg); }
    50% { transform: translateZ(20px) rotateZ(45deg) rotateX(-55deg) rotate(12deg); }
}

/* 进度条 + 名称(贴在土块上方,反向旋转,translateZ 浮起避免遮挡) */
.plot-label {
    position: absolute;
    left: 50%;
    bottom: 2px;
    transform: translate(-50%, 0) translateZ(28px) rotateZ(45deg) rotateX(-55deg);
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 4;
    pointer-events: none;
}

/* 选中高亮环 */
.plot.selected .plot-top {
    border-color: #FFD54F;
    box-shadow:
        0 4px 0 #6D4C41, 0 6px 0 #5D4037, 0 8px 0 #4E342E, 0 10px 0 #3E2723,
        0 0 0 3px rgba(255,213,79,0.9),
        0 14px 18px rgba(0,0,0,0.45);
}

/* ============================================================
   农夫小人(CSS 绘制)
   ============================================================ */
.character {
    position: absolute;
    left: 0; top: 0;
    width: 50px;
    height: 78px;
    transform-style: preserve-3d;
    /* 初始位置:农场前缘中央;反向旋转使小人站立朝向相机 */
    transform: translate(210px, 340px) rotateZ(45deg) rotateX(-55deg);
    transition: transform 0.9s cubic-bezier(.35,.05,.4,1);
    z-index: 10;
    pointer-events: none;
}

.char-shadow {
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 44px; height: 12px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(0,0,0,0.5), transparent 70%);
    border-radius: 50%;
    z-index: 1;
}

.char-inner {
    position: relative;
    width: 100%; height: 100%;
    transform-origin: bottom center;
    animation: idleBreath 2.4s ease-in-out infinite;
}
@keyframes idleBreath {
    0%,100% { transform: scaleY(1) translateY(0); }
    50% { transform: scaleY(1.03) translateY(-1px); }
}

/* 草帽 */
.char-hat {
    position: absolute;
    top: -6px; left: 50%;
    transform: translateX(-50%);
    width: 46px; height: 16px;
    background: linear-gradient(to bottom, #FFD54F, #FFA000);
    border-radius: 50%;
    box-shadow: 0 2px 0 #E65100;
    z-index: 3;
}
.char-hat::before {
    content: "";
    position: absolute;
    left: 50%; top: -8px;
    transform: translateX(-50%);
    width: 22px; height: 14px;
    background: linear-gradient(to bottom, #FFCA28, #FF8F00);
    border-radius: 50% 50% 40% 40%;
}

/* 头 */
.char-head {
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    width: 26px; height: 24px;
    background: radial-gradient(circle at 35% 30%, #FFE0B2, #FFCC80);
    border-radius: 50%;
    z-index: 2;
    box-shadow: inset -2px -2px 3px rgba(0,0,0,0.15);
}
.char-eye {
    position: absolute;
    top: 11px;
    width: 3px; height: 4px;
    background: #3E2723;
    border-radius: 50%;
}
.char-eye.left { left: 7px; }
.char-eye.right { right: 7px; }
.char-mouth {
    position: absolute;
    bottom: 6px; left: 50%;
    transform: translateX(-50%);
    width: 8px; height: 4px;
    border-bottom: 2px solid #3E2723;
    border-radius: 0 0 6px 6px;
}

/* 身体(背带裤) */
.char-body {
    position: absolute;
    top: 28px; left: 50%;
    transform: translateX(-50%);
    width: 30px; height: 28px;
    background: linear-gradient(to bottom, #42A5F5, #1565C0);
    border-radius: 8px 8px 6px 6px;
    z-index: 2;
    box-shadow: inset -3px 0 4px rgba(0,0,0,0.2);
}
.char-body::before {
    /* 背带 */
    content: "";
    position: absolute;
    top: 0; left: 6px; right: 6px;
    height: 10px;
    border-left: 3px solid #1E88E5;
    border-right: 3px solid #1E88E5;
}
.char-body::after {
    /* 扣子 */
    content: "";
    position: absolute;
    top: 8px; left: 6px;
    width: 3px; height: 3px;
    background: #FFEB3B;
    border-radius: 50%;
    box-shadow: 12px 0 0 #FFEB3B;
}

/* 手臂 */
.char-arm {
    position: absolute;
    top: 30px;
    width: 7px; height: 20px;
    background: linear-gradient(to bottom, #FFCC80, #FFB74D);
    border-radius: 4px;
    z-index: 1;
    transform-origin: top center;
}
.char-arm.left { left: 6px; }
.char-arm.right { right: 6px; }

/* 腿 */
.char-leg {
    position: absolute;
    top: 54px;
    width: 9px; height: 18px;
    background: linear-gradient(to bottom, #6D4C41, #4E342E);
    border-radius: 4px;
    z-index: 1;
    transform-origin: top center;
}
.char-leg.left { left: 13px; }
.char-leg.right { right: 13px; }

/* === 走路动画(整体弹跳 + 摆臂摆腿) === */
.character.walking .char-inner {
    animation: walkBounce 0.45s ease-in-out infinite;
}
.character.walking .char-arm.left { animation: armSwingL 0.45s ease-in-out infinite; }
.character.walking .char-arm.right { animation: armSwingR 0.45s ease-in-out infinite; }
.character.walking .char-leg.left { animation: legSwingL 0.45s ease-in-out infinite; }
.character.walking .char-leg.right { animation: legSwingR 0.45s ease-in-out infinite; }

@keyframes walkBounce {
    0%,100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes armSwingL { 0%,100% { transform: rotate(20deg); } 50% { transform: rotate(-20deg); } }
@keyframes armSwingR { 0%,100% { transform: rotate(-20deg); } 50% { transform: rotate(20deg); } }
@keyframes legSwingL { 0%,100% { transform: rotate(-15deg); } 50% { transform: rotate(15deg); } }
@keyframes legSwingR { 0%,100% { transform: rotate(15deg); } 50% { transform: rotate(-15deg); } }

/* === 操作动画 === */
/* 种植:弯腰 + 撒种子 */
.character.acting-plant .char-inner {
    animation: actBend 0.6s ease-in-out;
}
/* 浇水:举水壶 */
.character.acting-water .char-inner {
    animation: actBend 0.7s ease-in-out;
}
.character.acting-water .char-arm.right {
    animation: armRaise 0.7s ease-in-out;
}
/* 除草:挥手拔草 */
.character.acting-weed .char-inner {
    animation: actBend 0.6s ease-in-out;
}
.character.acting-weed .char-arm.left {
    animation: armPull 0.6s ease-in-out;
}
/* 除虫:喷药 */
.character.acting-pest .char-inner {
    animation: actBend 0.6s ease-in-out;
}
.character.acting-pest .char-arm.right {
    animation: armRaise 0.6s ease-in-out;
}
/* 收获:弯腰采摘 */
.character.acting-harvest .char-inner {
    animation: actBend 0.7s ease-in-out;
}
.character.acting-harvest .char-arm.left { animation: armPull 0.7s ease-in-out; }
.character.acting-harvest .char-arm.right { animation: armRaise 0.7s ease-in-out; }

@keyframes actBend {
    0% { transform: rotate(0); }
    35% { transform: rotate(-22deg) translateY(2px); }
    65% { transform: rotate(-22deg) translateY(2px); }
    100% { transform: rotate(0); }
}
@keyframes armRaise {
    0%,100% { transform: rotate(0); }
    40%,70% { transform: rotate(-110deg); }
}
@keyframes armPull {
    0%,100% { transform: rotate(0); }
    40%,70% { transform: rotate(80deg) translateY(-4px); }
}

/* 操作特效(飞出的种子/水滴/果实等) */
.char-effect {
    position: absolute;
    left: 50%; top: 30%;
    transform: translateX(-50%);
    font-size: 22px;
    pointer-events: none;
    z-index: 20;
    opacity: 0;
}
.char-effect.show {
    animation: effectFly 0.9s ease-out forwards;
}
@keyframes effectFly {
    0% { opacity: 0; transform: translate(-50%, 0) scale(0.5); }
    30% { opacity: 1; transform: translate(-50%, -10px) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50px) scale(0.8); }
}

/* ============================================================
   右侧面板
   ============================================================ */
.side-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-section {
    background: linear-gradient(to bottom, #FFF8DC, #FAEBD7);
    border-radius: 12px;
    padding: 12px;
    border: 3px solid #8B4513;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.panel-section h3 {
    color: #8B4513;
    margin-bottom: 10px;
    font-size: 15px;
    border-bottom: 2px dashed #D2B48C;
    padding-bottom: 5px;
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 2px dashed #D2B48C;
    padding-bottom: 5px;
}
.panel-header h3 { margin-bottom: 0; border: none; padding: 0; }
.online-count {
    font-size: 11px;
    color: #2E7D32;
    background: #E8F5E9;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ===== 聊天 ===== */
.chat-panel { display: flex; flex-direction: column; }
.chat-messages {
    height: 220px;
    overflow-y: auto;
    padding: 4px;
    background: rgba(255,255,255,0.5);
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background: #8B4513; border-radius: 3px; }

.chat-msg {
    max-width: 85%;
    padding: 5px 9px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-all;
    animation: msgIn 0.25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.chat-msg.other {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #E0E0E0;
    border-bottom-left-radius: 2px;
}
.chat-msg.self {
    align-self: flex-end;
    background: linear-gradient(to bottom, #C8E6C9, #A5D6A7);
    border-bottom-right-radius: 2px;
}
.chat-msg.system {
    align-self: center;
    background: #FFF3E0;
    color: #E65100;
    font-size: 11px;
    border-radius: 8px;
    border: 1px dashed #FFB74D;
}
.chat-msg-head {
    font-size: 10px;
    color: #888;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.chat-msg.self .chat-msg-head { color: #2E7D32; }
.chat-msg-content { color: #333; }
.chat-msg.self .chat-msg-content { color: #1B5E20; }

.chat-input-row { display: flex; gap: 6px; }
.chat-input-row input {
    flex: 1;
    padding: 7px 10px;
    border: 2px solid #D7B375;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
    background: #fff;
}
.chat-input-row input:focus { border-color: #FF8C00; }
.chat-input-row button {
    background: linear-gradient(to bottom, #66BB6A, #43A047);
    color: #fff;
    border: none;
    padding: 0 14px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 13px;
}
.chat-input-row button:hover { transform: translateY(-1px); }

/* ===== 操作面板 ===== */
.tool-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-bottom: 8px;
}
.tool-btn {
    background: linear-gradient(to bottom, #fff, #f0f0f0);
    border: 2px solid #8B4513;
    border-radius: 10px;
    padding: 9px 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    color: #5D3A1F;
    transition: all 0.2s;
}
.tool-btn:hover {
    background: linear-gradient(to bottom, #FFE4B5, #FFDAB9);
    transform: translateY(-2px);
}
.tool-btn.active {
    background: linear-gradient(to bottom, #FFA500, #FF8C00);
    color: #fff;
    border-color: #FF4500;
    box-shadow: 0 0 8px rgba(255,165,0,0.6);
}
.member-tools { display: flex; gap: 7px; }
.member-tools .tool-btn {
    flex: 1;
    background: linear-gradient(to bottom, #CE93D8, #AB47BC);
    color: #fff;
    border-color: #6A1B9A;
}
.member-tools .tool-btn:hover { transform: translateY(-2px); }
.member-tools .tool-btn.disabled {
    background: linear-gradient(to bottom, #BDBDBD, #9E9E9E);
    border-color: #757575;
    cursor: not-allowed;
}

/* ===== 系统消息 ===== */
.message-log {
    max-height: 180px;
    overflow-y: auto;
    font-size: 12px;
    padding: 2px;
}
.message-log::-webkit-scrollbar { width: 6px; }
.message-log::-webkit-scrollbar-thumb { background: #8B4513; border-radius: 3px; }
.message {
    background: rgba(255,255,255,0.7);
    padding: 5px 8px;
    margin-bottom: 4px;
    border-radius: 8px;
    border-left: 3px solid #4CAF50;
    color: #333;
    line-height: 1.4;
    animation: slideIn 0.3s ease;
}
.message.warn { border-left-color: #FF9800; color: #E65100; }
.message.error { border-left-color: #f44336; color: #B71C1C; }
.message.gain { border-left-color: #FFD700; color: #F57F17; font-weight: bold; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

/* ============================================================
   弹窗
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
}
.modal.active { display: flex; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
    background: linear-gradient(to bottom, #FFF8DC, #FAEBD7);
    border-radius: 16px;
    width: 90%;
    max-width: 720px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    border: 4px solid #8B4513;
    display: flex;
    flex-direction: column;
    animation: bounceIn 0.3s;
}
.modal-content.modal-small { max-width: 460px; }
@keyframes bounceIn {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.04); }
    100% { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: linear-gradient(to right, #8B4513, #A0522D, #8B4513);
    color: #fff;
    padding: 12px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header.member-header { background: linear-gradient(to right, #6A1B9A, #8E24AA, #6A1B9A); }
.modal-header h2 { font-size: 18px; }
.close-btn {
    background: rgba(255,0,0,0.3);
    color: #fff;
    border: none;
    width: 28px; height: 28px;
    border-radius: 50%;
    font-size: 14px;
    transition: all 0.2s;
}
.close-btn:hover { background: rgba(255,0,0,0.6); transform: rotate(90deg); }
.modal-body { padding: 16px; overflow-y: auto; }
.tip-text { color: #666; font-size: 13px; margin-bottom: 12px; font-style: italic; }

/* ===== 表单(充值/改密) ===== */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    color: #5D3A1F;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-group input, .form-group select {
    width: 100%;
    padding: 9px 12px;
    border: 2px solid #D7B375;
    border-radius: 10px;
    font-size: 14px;
    background: #fff;
    outline: none;
}
.form-group input:focus, .form-group select:focus { border-color: #FF8C00; }
.form-submit {
    width: 100%;
    padding: 11px;
    background: linear-gradient(to bottom, #FFB74D, #FF8C00);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: bold;
    box-shadow: 0 3px 0 #E65100;
    transition: all 0.15s;
}
.form-submit:hover { transform: translateY(-1px); }
.form-submit:active { transform: translateY(2px); box-shadow: 0 1px 0 #E65100; }

/* ===== 商店 ===== */
.shop-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.shop-item {
    background: #fff;
    border: 3px solid #8B4513;
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    transition: all 0.2s;
}
.shop-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.2);
    border-color: #FFA500;
}
.shop-item.locked { opacity: 0.5; filter: grayscale(0.6); }
.shop-item-emoji { font-size: 38px; margin-bottom: 4px; }
.shop-item-name { font-weight: bold; color: #5D3A1F; margin-bottom: 4px; }
.shop-item-info { font-size: 11px; color: #666; margin-bottom: 6px; line-height: 1.4; }
.shop-item-price { color: #FF8C00; font-weight: bold; margin-bottom: 8px; }
.buy-btn {
    background: linear-gradient(to bottom, #66BB6A, #43A047);
    color: #fff;
    border: none;
    padding: 6px 16px;
    border-radius: 16px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 13px;
}
.buy-btn:hover { transform: scale(1.05); }
.buy-btn:disabled { background: #999; cursor: not-allowed; transform: none; }

/* ===== 仓库 ===== */
.warehouse-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid #8B4513;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #5D3A1F;
    font-weight: bold;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tab-btn.active { color: #FF8C00; border-bottom-color: #FF8C00; }
.warehouse-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.warehouse-item {
    background: #fff;
    border: 2px solid #8B4513;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}
.warehouse-item-emoji { font-size: 30px; }
.warehouse-item-name { font-size: 12px; color: #5D3A1F; margin: 4px 0; }
.warehouse-item-count { font-weight: bold; color: #FF8C00; font-size: 13px; }
.sell-btn {
    background: linear-gradient(to bottom, #FFA500, #FF8C00);
    color: #fff;
    border: none;
    padding: 4px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 6px;
}
.sell-btn:hover { transform: scale(1.05); }
.sell-all-btn {
    background: linear-gradient(to bottom, #EF5350, #E53935);
    color: #fff;
    border: none;
    padding: 4px 8px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 11px;
    margin-top: 4px;
    margin-left: 4px;
}

/* ===== 好友列表 ===== */
.friends-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.friend-card {
    background: #fff;
    border: 3px solid #8B4513;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.friend-card:hover { transform: translateY(-4px); box-shadow: 0 6px 14px rgba(0,0,0,0.2); border-color: #FFA500; }
.friend-avatar { font-size: 38px; margin-bottom: 4px; }
.friend-name { font-weight: bold; color: #5D3A1F; margin-bottom: 4px; }
.friend-info { font-size: 12px; color: #666; }
.friend-dog { color: #B71C1C; font-size: 12px; margin-top: 4px; font-weight: bold; }

/* ===== 好友农场(偷菜) ===== */
.friend-farm-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.friend-plot {
    aspect-ratio: 1;
    background: radial-gradient(ellipse at center, #8B7355, #5D4E37);
    border-radius: 10px;
    border: 3px solid #4A2C12;
    display: flex; align-items: center; justify-content: center;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}
.friend-plot:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(255,0,0,0.5); }
.friend-plot.ready { background: radial-gradient(ellipse at center, #FFD700, #FFA500); animation: glow 1.5s infinite; }
.friend-plot.stolen { opacity: 0.4; cursor: not-allowed; }
.friend-plot .steal-tip {
    position: absolute; bottom: 4px; font-size: 10px;
    background: rgba(0,0,0,0.7); color: #fff; padding: 2px 6px; border-radius: 8px;
}
@keyframes glow {
    0%,100% { box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 0 8px rgba(255,215,0,0.6); }
    50% { box-shadow: inset 0 2px 6px rgba(0,0,0,0.4), 0 0 16px rgba(255,215,0,0.9); }
}

/* ===== 种子选择器 ===== */
.seed-picker-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.seed-picker-item {
    background: #fff;
    border: 2px solid #8B4513;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.seed-picker-item:hover { transform: scale(1.05); border-color: #FFA500; background: #FFF8DC; }
.seed-picker-item.disabled { opacity: 0.4; cursor: not-allowed; }
.seed-picker-emoji { font-size: 30px; }
.seed-picker-name { font-size: 12px; color: #5D3A1F; margin-top: 4px; font-weight: bold; }
.seed-picker-count { font-size: 11px; color: #888; }

/* ===== 会员 ===== */
.member-info {
    background: linear-gradient(to right, #F3E5F5, #E1BEE7);
    border: 2px solid #8E24AA;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #4A148C;
}
.member-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}
.member-plan {
    position: relative;
    background: linear-gradient(to bottom, #fff, #F3E5F5);
    border: 3px solid #8E24AA;
    border-radius: 12px;
    padding: 16px 10px;
    text-align: center;
}
.member-plan.plan-hot { border-color: #FFD54F; box-shadow: 0 0 12px rgba(255,213,79,0.6); }
.plan-tag {
    position: absolute;
    top: -10px; right: 8px;
    background: #FF5252;
    color: #fff;
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: bold;
}
.plan-title { font-size: 16px; font-weight: bold; color: #4A148C; }
.plan-days { font-size: 22px; font-weight: bold; color: #8E24AA; margin: 4px 0; }
.plan-price { color: #FF8C00; font-weight: bold; margin-bottom: 8px; }
.member-buy-btn { width: 100%; }

/* ===== 公告列表 ===== */
.announcement-list { display: flex; flex-direction: column; gap: 10px; }
.announcement-item {
    background: #fff;
    border: 2px solid #D7B375;
    border-left: 5px solid #FF8C00;
    border-radius: 8px;
    padding: 10px 12px;
}
.announcement-item-title { font-weight: bold; color: #5D3A1F; margin-bottom: 4px; }
.announcement-item-time { font-size: 11px; color: #888; margin-bottom: 6px; }
.announcement-item-content { font-size: 13px; color: #333; line-height: 1.5; }

/* ============================================================
   Toast 提示
   ============================================================ */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: rgba(0,0,0,0.85);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.2s forwards;
    max-width: 300px;
}
.toast.success { background: linear-gradient(to right, #43A047, #2E7D32); }
.toast.error { background: linear-gradient(to right, #E53935, #C62828); }
.toast.warn { background: linear-gradient(to right, #FB8C00, #E65100); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 1000px) {
    .game-area { grid-template-columns: 1fr; }
    .farm-scene { height: 460px; }
    .farm-board {
        width: 380px; height: 380px;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: repeat(4, 1fr);
    }
    .side-panel { max-height: none; }
    .chat-messages { height: 160px; }
}

@media (max-width: 640px) {
    .top-bar { padding: 8px 10px; }
    .top-buttons .btn-icon { padding: 6px 9px; font-size: 12px; }
    .farm-scene { height: 420px; }
    .farm-board { width: 320px; height: 320px; gap: 8px; }
    .plot-crop { font-size: 30px; }
    .friend-farm-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-buttons { grid-template-columns: repeat(2, 1fr); }
    .member-plans { grid-template-columns: 1fr; }
    .character { width: 42px; height: 68px; }
}

/* 折叠聊天面板按钮(窄屏) */
.chat-toggle {
    display: none;
    background: #8B4513;
    color: #fff;
    border: none;
    width: 100%;
    padding: 8px;
    font-size: 13px;
    font-weight: bold;
    border-radius: 8px;
    margin-bottom: 8px;
}
@media (max-width: 1000px) {
    .chat-toggle { display: block; }
    .chat-panel.collapsed .chat-messages,
    .chat-panel.collapsed .chat-input-row { display: none; }
}

/* ============================================================
   看家狗(CSS 绘制 + 走动动画)
   ============================================================ */
.dog {
    position: absolute;
    width: 46px;
    height: 36px;
    transform-style: preserve-3d;
    transform: translate(100px, 200px) translateZ(35px) rotateZ(45deg) rotateX(-55deg);
    z-index: 11;
    pointer-events: none;
    transition: transform 0.4s linear;
}

.dog-shadow {
    position: absolute;
    left: 50%;
    bottom: -2px;
    width: 40px; height: 10px;
    transform: translateX(-50%);
    background: radial-gradient(ellipse, rgba(0,0,0,0.45), transparent 70%);
    border-radius: 50%;
    z-index: 0;
}

.dog-body {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    width: 42px; height: 22px;
    background: linear-gradient(to bottom, #D2A06C, #A0724A);
    border-radius: 14px 18px 12px 14px;
    z-index: 2;
    box-shadow: inset -4px 0 6px rgba(0,0,0,0.25);
}

.dog-head {
    position: absolute;
    right: -2px;
    top: 2px;
    width: 20px; height: 18px;
    background: linear-gradient(to bottom, #D2A06C, #A0724A);
    border-radius: 10px 12px 8px 6px;
    z-index: 3;
    box-shadow: inset -2px 0 3px rgba(0,0,0,0.2);
}

.dog-ear {
    position: absolute;
    top: -4px;
    width: 8px; height: 12px;
    background: #8B5A2B;
    border-radius: 4px 4px 0 2px;
    z-index: 4;
}
.dog-ear.left  { left: 2px; transform: rotate(-20deg); }
.dog-ear.right { right: 2px; transform: rotate(15deg); }

.dog-eye {
    position: absolute;
    top: 6px;
    width: 3px; height: 3px;
    background: #1A1A1A;
    border-radius: 50%;
    z-index: 5;
}
.dog-eye.left  { left: 5px; }
.dog-eye.right { right: 5px; }

.dog-nose {
    position: absolute;
    right: -3px;
    top: 8px;
    width: 5px; height: 4px;
    background: #1A1A1A;
    border-radius: 50%;
    z-index: 5;
}

.dog-tail {
    position: absolute;
    left: -6px;
    top: 8px;
    width: 10px; height: 4px;
    background: #A0724A;
    border-radius: 4px 0 0 4px;
    z-index: 1;
    transform-origin: right center;
    animation: dogTailWag 0.5s ease-in-out infinite;
}
@keyframes dogTailWag {
    0%,100% { transform: rotate(20deg); }
    50%     { transform: rotate(-25deg); }
}

.dog-leg {
    position: absolute;
    width: 5px; height: 14px;
    background: linear-gradient(to bottom, #A0724A, #8B5A2B);
    border-radius: 2px;
    z-index: 1;
    transform-origin: top center;
}
.dog-leg.fl { left: 4px; top: 28px; }
.dog-leg.fr { left: 16px; top: 28px; }
.dog-leg.bl { left: 28px; top: 28px; }
.dog-leg.br { left: 36px; top: 28px; }

.dog.walking .dog-leg.fl { animation: dogLegFL 0.35s ease-in-out infinite; }
.dog.walking .dog-leg.fr { animation: dogLegFR 0.35s ease-in-out infinite; }
.dog.walking .dog-leg.bl { animation: dogLegBL 0.35s ease-in-out infinite; }
.dog.walking .dog-leg.br { animation: dogLegBR 0.35s ease-in-out infinite; }

@keyframes dogLegFL { 0%,100% { transform: rotate(-25deg); } 50% { transform: rotate(25deg); } }
@keyframes dogLegFR { 0%,100% { transform: rotate(25deg); }  50% { transform: rotate(-25deg); } }
@keyframes dogLegBL { 0%,100% { transform: rotate(25deg); }  50% { transform: rotate(-25deg); } }
@keyframes dogLegBR { 0%,100% { transform: rotate(-25deg); } 50% { transform: rotate(25deg); } }

.dog.walking {
    animation: dogWalkBob 0.35s ease-in-out infinite;
}
@keyframes dogWalkBob {
    0%,100% { filter: brightness(1); }
    50%     { filter: brightness(1.05); }
}

.dog.idle {
    animation: dogIdleBreathe 2s ease-in-out infinite;
}
@keyframes dogIdleBreathe {
    0%,100% { filter: brightness(1); }
    50%     { filter: brightness(1.06); }
}

/* 狗叫状态 */
.dog.barking .dog-head {
    animation: dogBark 0.3s ease-in-out 3;
}
@keyframes dogBark {
    0%,100% { transform: translate(0,0) rotate(0); }
    50%     { transform: translate(-2px, 1px) rotate(-8deg); }
}
