* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100%;
    height: 100vh;
}

.screen.active {
    display: block;
}

/* Login Screen */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    color: white;
}

.login-container h1 {
    font-size: 3em;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.login-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    min-width: 300px;
}

.login-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.9);
}

.login-form button {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

#loginBtn {
    background: #4CAF50;
    color: white;
}

#loginBtn:hover {
    background: #45a049;
    transform: translateY(-2px);
}

#registerBtn {
    background: #2196F3;
    color: white;
}

#registerBtn:hover {
    background: #0b7dda;
    transform: translateY(-2px);
}

.message {
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    display: none;
}

.message.error {
    background: rgba(244, 67, 54, 0.8);
    display: block;
}

.message.success {
    background: rgba(76, 175, 80, 0.8);
    display: block;
}

/* Top-left UI Panel */
.top-left-ui {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 100;
}

.ui-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    min-width: 200px;
}

.ui-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.ui-item:last-child {
    margin-bottom: 0;
}

.ui-icon {
    font-size: 24px;
}

.food-bar-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.food-bar-label {
    font-size: 14px;
    color: #666;
    font-weight: normal;
}

.food-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}

.food-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 10px;
    transition: width 0.3s;
    width: 100%;
}

.food-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: bold;
    color: #333;
    z-index: 1;
}

.pet-level-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
}

.pet-level-label {
    font-size: 14px;
    color: #333;
}

.pet-level-text {
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

/* Game Screen */
.game-header {
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10;
}

.user-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.user-info span {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

#friendsBtn {
    background: #FF9800;
    color: white;
}

#friendsBtn:hover {
    background: #F57C00;
}

#saveBtn {
    background: #2196F3;
    color: white;
}

#saveBtn:hover {
    background: #0b7dda;
}

#logoutBtn {
    background: #f44336;
    color: white;
}

#logoutBtn:hover {
    background: #da190b;
}

.game-container {
    display: flex;
    height: calc(100vh - 70px);
    background: #f5f5f5;
}

.sidebar {
    width: 300px;
    background: white;
    padding: 20px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar h3 {
    margin-bottom: 15px;
    color: #333;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.shop-section, .inventory-section {
    margin-bottom: 30px;
}

.shop-item, .inventory-item {
    display: flex;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.shop-item:hover, .inventory-item:hover {
    background: #e8f5e9;
    transform: translateX(5px);
}

.shop-item img, .inventory-item img {
    width: 40px;
    height: 40px;
    margin-right: 10px;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: bold;
    color: #333;
}

.item-price {
    color: #4CAF50;
    font-size: 14px;
}

.item-count {
    color: #666;
    font-size: 14px;
}

.farm-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* Right-side Tools */
.right-tools {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 50;
}

.tool-icon {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.tool-icon:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* Bottom Toolbar */
.bottom-toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    border-radius: 50px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 100;
}

.toolbar-icon {
    width: 45px;
    height: 45px;
    background: #f5f5f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.toolbar-icon:hover {
    transform: scale(1.15);
    background: #e8f5e9;
    border-color: #4CAF50;
}

.toolbar-icon.active {
    background: #4CAF50;
    color: white;
    border-color: #45a049;
}

#gameCanvas {
    background: #8BC34A;
    border: 3px solid #689F38;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    cursor: crosshair;
}

.farm-info {
    margin-top: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    min-width: 300px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.friends-tabs {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab-btn.active {
    border-bottom-color: #4CAF50;
    color: #4CAF50;
    font-weight: bold;
}

.tab-panel {
    display: none;
    margin-top: 20px;
}

.tab-panel.active {
    display: block;
}

.friend-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: #f9f9f9;
    border-radius: 8px;
}

.friend-name {
    font-weight: bold;
    color: #333;
}

.friend-actions {
    display: flex;
    gap: 10px;
}

.friend-actions button {
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.btn-visit {
    background: #4CAF50;
    color: white;
}

.btn-remove {
    background: #f44336;
    color: white;
}

.btn-accept {
    background: #2196F3;
    color: white;
}

.btn-reject {
    background: #f44336;
    color: white;
}

#searchUsername {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
}

#searchBtn {
    width: 100%;
    padding: 12px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
}

#searchBtn:hover {
    background: #45a049;
}

