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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #eee;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

input, textarea {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

#chat-input {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

/* Chat log text stays selectable; everything else in-game is not */
#chat-messages, #chat-messages * {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

.screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

#name-screen {
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #12251a 0%, #1a2e33 55%, #20303f 100%);
}

.name-screen-content {
  text-align: center;
  background: rgba(10, 20, 15, 0.82);
  backdrop-filter: blur(6px);
  padding: 3rem 4rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.name-screen-content h1 {
  font-size: 3rem;
  margin-bottom: 0.25rem;
  background: linear-gradient(90deg, #a8e063, #56ab2f);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.name-screen-content .subtitle {
  color: #8aa58f;
  font-size: 0.95rem;
  margin-bottom: 1.75rem;
}

#player-name, #player-pass {
  width: 100%;
  max-width: 300px;
  padding: 1rem 1.25rem;
  font-size: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #eee;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#player-pass {
  margin-top: 0.75rem;
}

#player-name:focus, #player-pass:focus {
  border-color: #56ab2f;
  box-shadow: 0 0 0 3px rgba(86, 171, 47, 0.25);
}

.remember-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 0.9rem;
  color: #8aa58f;
  font-size: 0.9rem;
  cursor: pointer;
}

.auth-error {
  color: #ff9090;
  min-height: 1.2em;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}

.logout-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 120;
  padding: 0.5rem 0.9rem;
  background: rgba(10, 18, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  color: #eee;
  font-weight: 700;
  cursor: pointer;
}

.logout-btn:hover {
  background: rgba(214, 69, 69, 0.5);
  color: #fff;
}

#join-btn {
  margin-top: 1.5rem;
  padding: 1rem 3rem;
  font-size: 1.2rem;
  font-weight: 600;
  background: linear-gradient(135deg, #56ab2f, #3e8e1e);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

#join-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 30px rgba(86, 171, 47, 0.4);
}

#join-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.hint {
  margin-top: 1.25rem;
  color: #7a9280;
  font-size: 0.9rem;
}

#game-screen {
  justify-content: flex-start;
  align-items: stretch;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #2f7430;
}

/* ==============================
   HOTBAR
   ============================== */

.backpack-btn {
  position: fixed;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  background: rgba(10, 18, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  z-index: 99;
  transition: transform 0.12s ease, background 0.12s ease;
}

.backpack-btn:hover {
  background: rgba(28, 46, 32, 0.85);
  transform: translateY(-50%) scale(1.06);
}

.settings-btn {
  position: fixed;
  left: 18px;
  top: calc(50% + 92px);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(10, 18, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 8px 10px;
  font-size: 1.7rem;
  line-height: 1;
  z-index: 99;
  transition: transform 0.12s ease, background 0.12s ease;
}

.settings-btn:hover {
  background: rgba(28, 46, 32, 0.85);
  transform: translateY(-50%) scale(1.06);
}

.settings-panel {
  position: fixed;
  bottom: 104px;
  left: 20px;
  width: 320px;
  height: 470px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(22, 30, 24, 0.96), rgba(14, 20, 16, 0.96));
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 1rem;
  z-index: 100;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.settings-panel.hidden {
  display: none;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  margin-bottom: 0.9rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.wheel-toggle {
  background: rgba(86, 171, 47, 0.25);
  border: 1px solid #56ab2f;
  color: #a8e063;
  font-weight: 800;
  border-radius: 8px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
}

.wheel-toggle.off {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  color: #8aa58f;
}

.settings-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a8e063;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.bind-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0.9rem;
}

.bind-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 0.3rem 0.2rem;
}

.bind-key {
  min-width: 86px;
  text-align: center;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #ffe082;
  font-weight: 700;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.bind-key.armed {
  border-color: #ffd54f;
  color: #ffd54f;
  animation: bindPulse 0.8s ease infinite alternate;
}

@keyframes bindPulse {
  from { box-shadow: 0 0 0 rgba(255, 213, 79, 0); }
  to { box-shadow: 0 0 12px rgba(255, 213, 79, 0.6); }
}

.reset-binds {
  width: 100%;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  color: #c5d5c8;
  cursor: pointer;
  font-weight: 600;
}

.reset-binds:hover {
  border-color: #56ab2f;
}

.backpack-icon {
  font-size: 2.1rem;
  line-height: 1;
}

.backpack-key {
  font-size: 0.95rem;
  font-weight: 700;
  color: #a8e063;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(168, 224, 99, 0.4);
  border-radius: 6px;
  padding: 0 7px;
  line-height: 1.4;
}

.hotbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(20, 28, 22, 0.92), rgba(12, 18, 14, 0.92));
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  z-index: 100;
}

.hotbar-slot {
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.hotbar-slot:hover {
  transform: translateY(-2px);
}

.hotbar-slot.active {
  border-color: #56ab2f;
  box-shadow: 0 0 16px rgba(86, 171, 47, 0.55), inset 0 0 10px rgba(86, 171, 47, 0.2);
  transform: translateY(-2px) scale(1.05);
}

.slot-number {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 0.68rem;
  color: #9ab19f;
  font-weight: 700;
}

.slot-item {
  width: 38px;
  height: 38px;
  font-size: 32px;
  line-height: 38px;
  text-align: center;
}

.slot-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #eee;
  text-shadow: 0 1px 2px #000;
}

/* ==============================
   LEVEL HUD / XP BAR
   ============================== */

.level-hud {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 240px;
  background: linear-gradient(180deg, rgba(18, 26, 20, 0.92), rgba(12, 18, 14, 0.92));
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 0.65rem 0.75rem;
  z-index: 95;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.level-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #ffd54f, #ffb300);
  color: #4e342e;
  font-weight: 800;
  font-size: 1.05rem;
  padding: 4px 10px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(255, 193, 7, 0.35);
  flex-shrink: 0;
}

.level-emoji { font-size: 0.95rem; }
.level-number { min-width: 1ch; text-align: center; }

.level-xp { flex: 1; min-width: 0; }

.level-xp-bar {
  height: 9px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 4px;
}

.level-xp-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #56ab2f, #a8e063);
  border-radius: 5px;
  transition: width 0.4s ease;
}

.level-xp-text {
  display: block;
  font-size: 0.7rem;
  color: #8aa58f;
  font-weight: 600;
  text-align: right;
}

/* Leaderboard level badge */
.lb-level {
  font-size: 0.72rem;
  background: rgba(255, 213, 79, 0.18);
  color: #ffd54f;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .level-hud { width: 180px; }
}

/* ==============================
   LEADERBOARD
   ============================== */

.leaderboard {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 230px;
  background: linear-gradient(180deg, rgba(18, 26, 20, 0.92), rgba(12, 18, 14, 0.92));
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 0.75rem;
  z-index: 90;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
}

.leaderboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.leaderboard-title {
  font-weight: 700;
  font-size: 1rem;
}

.leaderboard-list {
  max-height: 260px;
  overflow-y: auto;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 0.9rem;
}

.leaderboard-row.me {
  background: rgba(86, 171, 47, 0.18);
  border: 1px solid rgba(86, 171, 47, 0.4);
}

.lb-rank {
  width: 22px;
  text-align: center;
  font-weight: 700;
  color: #ffd700;
}

.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-coins {
  font-weight: 700;
  color: #ffd700;
}

/* Free-seed lifeline (under the leaderboard) */
.lifeline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.lifeline-btn {
  flex: 1;
  padding: 0.5rem 0.25rem;
  background: linear-gradient(135deg, #56ab2f, #3e8e1e);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  transition: filter 0.2s, transform 0.2s;
}

.lifeline-btn:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.lifeline-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.lifeline-timer {
  font-size: 0.75rem;
  color: #8aa58f;
  font-weight: 600;
  min-width: 38px;
  text-align: right;
}

/* ==============================
   CROP INFO PANEL
   ============================== */

.crop-info {
  position: fixed;
  top: 64px;
  left: 16px;
  width: 240px;
  background: linear-gradient(180deg, rgba(24, 34, 26, 0.94), rgba(14, 20, 16, 0.94));
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  padding: 1rem;
  z-index: 90;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.crop-info.hidden {
  display: none;
}

.crop-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ccc;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.crop-close:hover {
  background: rgba(214, 69, 69, 0.5);
  color: #fff;
}

.pickup-big-btn {
  width: 100%;
  margin-top: 12px;
  padding: 10px 0;
  background: linear-gradient(135deg, #56ab2f, #3e8e1e);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
}

.pickup-big-btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
}

.pickup-big-btn:active {
  transform: translateY(0);
}

.crop-info-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 0.9rem;
}

.crop-emoji {
  font-size: 2.2rem;
}

.crop-name {
  font-weight: 700;
  font-size: 1.15rem;
}

.crop-status {
  font-size: 0.82rem;
  color: #9ab19f;
  margin-top: 2px;
}

.crop-progress {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.6rem;
}

.crop-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #56ab2f, #a8e063);
  border-radius: 6px;
  transition: width 0.3s ease;
}

.crop-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.7rem;
}

.crop-timer {
  color: #8ec8ff;
  font-weight: 600;
}

.crop-water {
  color: #42a5f5;
  font-weight: 600;
}

.crop-stages {
  display: flex;
  gap: 6px;
}

.crop-stage-pip {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  padding: 4px 0;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #9ab19f;
}

.crop-stage-pip.active {
  background: rgba(86, 171, 47, 0.25);
  color: #a8e063;
  box-shadow: 0 0 8px rgba(86, 171, 47, 0.3);
}

/* ==============================
   SHOP
   ============================== */

.shop-panel {
  position: fixed;
  bottom: 104px;
  left: 20px;
  width: 320px;
  height: 470px;
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(22, 30, 24, 0.96), rgba(14, 20, 16, 0.96));
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 1rem;
  z-index: 100;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}

.shop-panel.hidden {
  display: none;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9rem;
}

.shop-header h3 {
  color: #a8e063;
  font-size: 1.2rem;
}

.shop-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ccc;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.shop-close:hover {
  background: rgba(214, 69, 69, 0.5);
  color: #fff;
}

.shop-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 1rem;
}

.shop-tab {
  flex: 1;
  padding: 0.55rem 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  color: #c5d5c8;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.shop-tab.active {
  background: linear-gradient(135deg, #56ab2f, #3e8e1e);
  border-color: #56ab2f;
  color: #fff;
  box-shadow: 0 4px 14px rgba(86, 171, 47, 0.35);
}

.shop-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.shop-content.hidden {
  display: none;
}

.shop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.shop-item:hover:not(.locked) {
  background: rgba(86, 171, 47, 0.14);
  border-color: #56ab2f;
  transform: translateX(3px);
}

.shop-item.locked {
  opacity: 0.55;
  cursor: not-allowed;
}

.item-icon {
  font-size: 1.6rem;
  width: 40px;
  text-align: center;
  flex-shrink: 0;
}

.item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.item-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.item-desc {
  font-size: 0.75rem;
  color: #8aa58f;
}

.item-buy {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.item-price {
  color: #ffd700;
  font-weight: 700;
  font-size: 0.9rem;
}

.lock-badge {
  font-size: 0.62rem;
  background: rgba(214, 69, 69, 0.25);
  color: #ff9090;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sell-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sell-all-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0.6rem 0.8rem;
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.35);
  border-radius: 12px;
}

.sell-all-label {
  font-size: 0.8rem;
  color: #ffe28a;
  font-weight: 600;
}

.sell-all-btn {
  background: linear-gradient(135deg, #ffcc33, #ffb700);
  border: none;
  color: #2a2400;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.sell-all-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 215, 0, 0.35);
}

.sell-empty {
  text-align: center;
  color: #8aa58f;
  padding: 1.5rem 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.sell-item:hover {
  background: rgba(255, 215, 0, 0.12);
  border-color: #ffd700;
}

.shop-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  padding: 0.7rem 0.9rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#coin-display {
  color: #ffd700;
}

/* ==============================
   INVENTORY
   ============================== */

.inventory-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 440px;
  max-height: 80vh;
  background: linear-gradient(180deg, rgba(22, 30, 24, 0.97), rgba(14, 20, 16, 0.97));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 1.25rem;
  z-index: 200;
  overflow-y: auto;
  box-shadow: 0 16px 60px rgba(0, 0, 0, 0.6);
}

.inventory-panel.hidden {
  display: none;
}

.inventory-panel h3 {
  margin-bottom: 1rem;
  color: #a8e063;
}

.inventory-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 1.25rem;
}

.inventory-slot {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 2rem;
  transition: all 0.2s;
}

.inventory-slot:hover {
  border-color: #56ab2f;
  background: rgba(86, 171, 47, 0.12);
}

.inventory-slot .slot-item {
  width: 100%;
  height: 100%;
  font-size: 2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inventory-slot .item-count {
  position: absolute;
  bottom: 3px;
  right: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}

#close-inventory {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #56ab2f, #3e8e1e);
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: background 0.2s;
}

#close-inventory:hover {
  filter: brightness(1.1);
}

/* ==============================
   PLOT INFO / CHAT / NOTIFICATION
   ============================== */

.plot-info {
  position: fixed;
  top: 20px;
  right: 270px;
  width: 260px;
  background: rgba(0, 0, 0, 0.9);
  border: 2px solid #0f3460;
  border-radius: 12px;
  padding: 1rem;
  z-index: 100;
}

.plot-info.hidden {
  display: none;
}

.plot-info-content {
  font-size: 0.9rem;
  line-height: 1.6;
}

.plot-info .crop-name {
  font-weight: bold;
  color: #e94560;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.plot-info .crop-stage {
  color: #ffd700;
}

.plot-info .crop-timer {
  color: #4ecdc4;
}

.plot-info .owner {
  color: #888;
  font-size: 0.8rem;
}

.chat-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 300px;
  height: 210px;
  background: rgba(14, 20, 16, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.chat-panel.hidden {
  display: none;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.5rem 0.35rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.chat-title {
  font-weight: 700;
  font-size: 0.85rem;
  color: #c5d5c8;
}

.chat-close {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #ccc;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
}

.chat-close:hover {
  background: rgba(214, 69, 69, 0.5);
  color: #fff;
}

.chat-open-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  background: linear-gradient(180deg, rgba(20, 28, 22, 0.95), rgba(12, 18, 14, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  z-index: 100;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.chat-open-btn.hidden {
  display: none;
}

.chat-open-btn:hover {
  border-color: #56ab2f;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.chat-message {
  margin-bottom: 0.5rem;
}

.chat-message .sender {
  color: #a8e063;
  font-weight: bold;
}

.chat-message .message {
  color: #ddd;
}

#chat-input {
  width: 100%;
  padding: 0.55rem;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-top: none;
  color: #eee;
  outline: none;
  font-size: 0.9rem;
}

#chat-input:focus {
  border-color: #56ab2f;
}

.notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 18, 12, 0.94);
  border: 1px solid rgba(86, 171, 47, 0.5);
  border-radius: 12px;
  padding: 0.9rem 1.8rem;
  font-weight: 600;
  z-index: 300;
  margin-top: 78px;
  animation: slideDown 0.3s ease;
}

.notification.hidden {
  display: none;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ==============================
   SCROLLBARS
   ============================== */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .hotbar-slot {
    width: 54px;
    height: 54px;
  }
  .shop-panel, .chat-panel {
    width: calc(100% - 40px);
    left: 20px;
    right: 20px;
  }
  .inventory-panel {
    width: calc(100% - 40px);
  }
  .leaderboard {
    width: 170px;
  }
}

/* ==============================
   INVENTORY: 15 slots (bag + hotbar rows)
   ============================== */

.inventory-slot.selected {
  border-color: #56ab2f;
  box-shadow: 0 0 12px rgba(86, 171, 47, 0.45);
}

.inventory-slot.moving {
  border-color: #ffd54f;
  box-shadow: 0 0 12px rgba(255, 213, 79, 0.45);
  transform: scale(1.04);
}

.inventory-slot.dragging {
  opacity: 0.45;
  transform: scale(0.9);
}

.inventory-slot.drag-over {
  border-color: #ffd54f;
  background: rgba(255, 213, 79, 0.18);
  box-shadow: 0 0 14px rgba(255, 213, 79, 0.5);
}

.inventory-slot.tinted-dim {
  opacity: 0.7;
}

.inv-hotbar-label {
  grid-column: 1 / -1;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a8e063;
  text-transform: uppercase;
  border-top: 1px dashed rgba(255, 255, 255, 0.18);
  padding-top: 10px;
  margin-top: 6px;
}

/* ==============================
   SHOP: extra tabs
   ============================== */

.tab-hint {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #9caf88;
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.8rem;
}

