:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-hover: #2d2d2d;
    --primary: #4CAF50;
    --primary-hover: #43a047;
    --accent: #2196F3;
    --text-main: #e0e0e0;
    --text-sub: #a0a0a0;
    --border: #333;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --radius: 12px;
}

body.light-theme {
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --bg-hover: #e0e0e0;
    --primary: #43a047;
    --primary-hover: #2e7d32;
    --accent: #1976D2;
    --text-main: #333333;
    --text-sub: #666666;
    --border: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Segoe UI', system-ui, sans-serif; 
    background-color: var(--bg-dark); 
    color: var(--text-main); 
    height: 100vh; 
    overflow: hidden; 
    transition: background-color 0.3s, color 0.3s; 
}

.app-container { display: flex; height: 100%; }

.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(4px);
}

.login-overlay.show { display: flex; }

.login-card {
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-sub {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 16px;
}

.login-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-dark);
    color: var(--text-main);
    outline: none;
}

.login-input:focus { border-color: var(--primary); }

.login-error {
    min-height: 18px;
    color: #F44336;
    font-size: 12px;
    margin: 8px 0 12px;
}

.login-btn { width: 100%; }

.sidebar {
    width: 260px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
    padding: 0 10px;
}
.logo-icon { font-size: 24px; color: var(--primary); }
.logo-area h2 { font-size: 20px; font-weight: 600; }

.account-selector {
    position: relative;
    margin-bottom: 20px;
}

.current-account {
    background: var(--bg-hover);
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border);
    transition: 0.2s;
    color: var(--text-main);
}

.current-account:hover {
    border-color: var(--primary);
}

.account-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-top: 5px;
    display: none;
    z-index: 100;
    box-shadow: var(--shadow);
    max-height: 200px;
    overflow-y: auto;
}

.account-dropdown.show {
    display: block;
}

.account-option {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.account-option:hover {
    background: var(--bg-hover);
}

.account-option.active {
    color: var(--primary);
}

.nav-menu { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: var(--text-sub);
    border-radius: var(--radius);
    transition: 0.2s;
}
.nav-item:hover, .nav-item.active {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary);
}
.nav-item i { width: 20px; text-align: center; }

.status-mini {
    margin-top: auto;
    padding: 15px;
    background: var(--bg-dark);
    border-radius: var(--radius);
    font-size: 0.9em;
    color: var(--text-sub);
}
.connection-status { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot.online { background: #4CAF50; box-shadow: 0 0 5px #4CAF50; }
.dot.offline { background: #F44336; }

.system-time {
    font-size: 12px;
    color: var(--text-sub);
    margin-top: 5px;
    text-align: center;
    opacity: 0.8;
}

.main-content { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    overflow: hidden; 
    background: var(--bg-dark); 
    transition: background-color 0.3s; 
}

.top-bar {
    height: 60px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s;
}

.actions { display: flex; gap: 10px; }
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-main); }

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}
.card-header h3 { 
    font-size: 16px; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 25px;
    gap: 20px;
}
.stat-icon {
    width: 50px; 
    height: 50px;
    border-radius: 12px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.stat-icon.accounts { background: rgba(156, 39, 176, 0.1); color: #9C27B0; }

.stat-info { flex: 1; }
.stat-info h3 { font-size: 14px; color: var(--text-sub); margin-bottom: 5px; }
.stat-info .value { font-size: 24px; font-weight: bold; transition: color 0.3s; }

.logs-container { 
    max-height: 400px; 
    overflow-y: auto; 
    font-family: 'Consolas', monospace; 
    font-size: 13px; 
}
.log-row { 
    padding: 4px 0; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    display: flex; 
    gap: 10px; 
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.account-card {
    background: var(--bg-hover);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: 0.2s;
}

.account-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.account-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.account-info {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
}

.info-row .label {
    color: var(--text-sub);
}

.info-row .value {
    color: var(--text-main);
}

.code-text {
    font-family: 'Consolas', monospace;
    font-size: 11px;
}

.account-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.form-group { margin-bottom: 15px; }
.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    color: var(--text-sub); 
    font-size: 14px; 
}
.form-control {
    width: 100%; 
    background: var(--bg-dark); 
    border: 1px solid var(--border); 
    color: var(--text-main);
    padding: 10px; 
    border-radius: 6px; 
    outline: none;
}
.form-control:focus { border-color: var(--primary); }

.btn {
    padding: 10px 20px; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: 0.2s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-warning {
    background: #FF9800;
    color: #fff;
}

.btn-warning:hover {
    background: #F57C00;
}

.btn-danger {
    background: transparent;
    color: #F44336;
    border: 1px solid #F44336;
}

.btn-danger:hover {
    background: #F44336;
    color: #fff;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    width: 400px;
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    max-width: 90%;
    color: var(--text-main);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 18px;
}

.close-modal {
    cursor: pointer;
    font-size: 24px;
    color: var(--text-sub);
}

.close-modal:hover {
    color: var(--text-main);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }


/* 设置页面 */
.row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.col-6 {
    flex: 1;
    min-width: 300px;
}

.card-body {
    padding: 0;
}

.help-text {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 10px;
}

textarea.form-control {
    resize: vertical;
    font-family: 'Consolas', monospace;
    font-size: 13px;
}

.switches-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.switch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: var(--text-main);
}

.switch-item input {
    display: none;
}

.slider {
    width: 40px;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 20px;
    position: relative;
    transition: 0.3s;
}

.slider:before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    top: 2px;
    left: 2px;
    transition: 0.3s;
}

input:checked + .slider {
    background: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.stat-icon.exp {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    margin: 5px 0;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s;
}

/* 农场土地网格 */
.lands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
}

.land-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.land-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: var(--accent);
}

.land-card.empty {
    border-style: dashed;
    opacity: 0.6;
}

.land-card.mature {
    border-color: #10b981;
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.land-card.dead {
    border-color: #ef4444;
    opacity: 0.7;
}

.land-number {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 8px;
}

.land-plant-icon {
    font-size: 32px;
    margin: 10px 0;
}

.land-plant-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
}

.land-status {
    font-size: 12px;
    color: var(--text-sub);
    margin: 5px 0;
}

.land-badges {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.land-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    background: var(--bg);
}

.land-badge.water { color: #3b82f6; }
.land-badge.weed { color: #10b981; }
.land-badge.bug { color: #ef4444; }

.land-actions {
    display: flex;
    gap: 5px;
    margin-top: 10px;
}

.land-actions .btn {
    flex: 1;
    padding: 5px;
    font-size: 11px;
}

/* 好友网格 */
.friends-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    padding: 20px;
}

.friend-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    transition: all 0.3s;
}

.friend-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.friend-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}

.friend-level {
    font-size: 12px;
    color: var(--text-sub);
}

.friend-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
    padding: 10px;
    background: var(--bg);
    border-radius: 8px;
}

.friend-stat {
    flex: 1;
    text-align: center;
}

.friend-stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
}

.friend-stat-label {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 2px;
}

.friend-actions {
    display: flex;
    gap: 8px;
}

.friend-actions .btn {
    flex: 1;
}

/* 按钮块级 */
.btn-block {
    width: 100%;
    margin-bottom: 10px;
}

.btn-block:last-child {
    margin-bottom: 0;
}

/* 好友操作弹窗 */
.friend-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 扫码登录相关样式 */
#qr-iframe {
    background: var(--bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.modal-content {
    max-width: 500px;
}

/* 扫码按钮样式 */
#btn-qr-login {
    white-space: nowrap;
    min-width: 120px;
}

#btn-qr-login i {
    margin-right: 5px;
}

/* 土地选择样式 */
.land-card.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.land-card[data-land-id] {
    transition: all 0.3s;
}

.land-card[data-land-id]:hover:not(.disabled) {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
}

#friend-lands-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

#friend-lands-grid .land-card {
    padding: 10px;
}
