* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #0f1419 0%, #1a2332 50%, #0d1117 100%);
  color: #e6edf3;
  min-height: 100vh;
  transition: background 0.5s ease;
}

body.bg-phase-dawn.bg-weather-sun { background: linear-gradient(160deg, #2c1810 0%, #4a2c1a 50%, #1a2332 100%); }
body.bg-phase-day.bg-weather-sun { background: linear-gradient(160deg, #0f1419 0%, #1a2332 50%, #0d1117 100%); }
body.bg-phase-dusk.bg-weather-sun { background: linear-gradient(160deg, #2a1a24 0%, #1a1520 50%, #0d1117 100%); }
body.bg-phase-night.bg-weather-sun { background: linear-gradient(160deg, #0a0e14 0%, #0d1117 50%, #050810 100%); }
body.bg-phase-dawn.bg-weather-cloudy { background: linear-gradient(160deg, #2a2620 0%, #3d3830 50%, #1e2228 100%); }
body.bg-phase-day.bg-weather-cloudy { background: linear-gradient(160deg, #1e2228 0%, #252a32 50%, #161b22 100%); }
body.bg-phase-dusk.bg-weather-cloudy { background: linear-gradient(160deg, #1a1818 0%, #1e2228 50%, #0d1117 100%); }
body.bg-phase-night.bg-weather-cloudy { background: linear-gradient(160deg, #0c0e12 0%, #0d1117 50%, #080a0d 100%); }
body.bg-phase-dawn.bg-weather-rain { background: linear-gradient(160deg, #1a2028 0%, #252d38 50%, #161b22 100%); }
body.bg-phase-day.bg-weather-rain { background: linear-gradient(160deg, #161c24 0%, #1c232d 50%, #0d1117 100%); }
body.bg-phase-dusk.bg-weather-rain { background: linear-gradient(160deg, #14181e 0%, #181c24 50%, #0a0e12 100%); }
body.bg-phase-night.bg-weather-rain { background: linear-gradient(160deg, #080a0e 0%, #0d1117 50%, #050708 100%); }

.boot-panel {
  max-width: 360px;
  margin: 40px auto;
  padding: 24px;
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  border-radius: 12px;
  border: 1px solid #30363d;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.boot-panel h1 { margin: 0 0 16px 0; font-size: 1.25rem; color: #58a6ff; }
.boot-panel p { margin: 0 0 12px 0; font-size: 0.9rem; color: #8b949e; }
.boot-panel input { width: 100%; padding: 10px 12px; margin-bottom: 12px; border-radius: 8px; border: 1px solid #30363d; background: #0d1117; color: #e6edf3; font-size: 1rem; }
.boot-panel button { padding: 10px 20px; border-radius: 8px; border: 1px solid #388bfd; background: #238636; color: #fff; cursor: pointer; font-size: 0.95rem; }
.boot-panel button:hover { background: #2ea043; }
.boot-err { color: #f85149; font-size: 0.85rem; margin-top: 8px; }

#root {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px;
  align-items: flex-start;
}

.game-bar {
  flex: 0 0 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-bar-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.game-bar-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #58a6ff;
}

.game-bar-title-wrap .help-wrap {
  display: inline-flex;
}

.game-bar-title-wrap .tooltip-bubble.below {
  left: 0;
  top: 100%;
  margin-top: 6px;
}

.game-bar .status-bar {
  flex: 1 1 auto;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.game-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.game-bar-view-switcher {
  display: flex;
  align-items: center;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #30363d;
}

.game-bar-view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  color: #8b949e;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.game-bar-view-btn:hover {
  background: #30363d;
  color: #e6edf3;
}

.game-bar-view-btn.active {
  background: #238636;
  color: #fff;
}

.game-bar-view-btn + .game-bar-view-btn {
  border-left: 1px solid #30363d;
}

.game-bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  color: #e6edf3;
  font-size: 1.2rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.game-bar-btn:hover:not(:disabled) {
  background: #30363d;
  border-color: #58a6ff;
}

.game-bar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-bar-btn-prestige {
  border-color: #da3633;
  background: linear-gradient(180deg, #3d1f1f 0%, #2a1515 100%);
  color: #f85149;
}

.game-bar-btn-prestige:hover:not(:disabled) {
  background: #4d2525;
  border-color: #f85149;
}

.game-bar-btn-music.muted {
  opacity: 0.45;
  filter: grayscale(1);
}

.game-bar-quest-wrap {
  position: relative;
}

.quest-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  min-width: 260px;
  max-width: 320px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px 12px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.game-bar-quest-wrap.open .quest-dropdown {
  display: block;
}

.quest-dropdown-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #58a6ff;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #21262d;
}

.quest-dropdown .quest-list {
  margin-top: 0;
}

.panel {
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  border-radius: 12px;
  padding: 16px;
  min-width: 300px;
  border: 1px solid #30363d;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.panel h2 {
  margin: 0 0 12px 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #58a6ff;
}

.status {
  font-size: 0.9rem;
  margin-bottom: 10px;
  word-break: break-word;
  padding: 8px 10px;
  background: #0d1117;
  border-radius: 8px;
  border: 1px solid #21262d;
}

.music-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.music-toggle-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #58a6ff;
}

.music-toggle-wrap label {
  cursor: pointer;
  user-select: none;
}

.hint {
  font-size: 0.85rem;
  color: #8b949e;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: rgba(88, 166, 255, 0.08);
  border-radius: 8px;
  border-left: 3px solid #58a6ff;
}

.conveyor-strip {
  display: flex;
  overflow: hidden;
  padding: 12px 0;
  min-height: 90px;
  border: 1px solid #30363d;
  border-radius: 10px;
  margin-bottom: 14px;
  background: linear-gradient(90deg, #0d1117 0%, #161b22 50%, #0d1117 100%);
  background-size: 200% 100%;
  animation: conveyor-bg 3s linear infinite;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(56, 139, 253, 0.15);
}

.conveyor-title {
  position: absolute;
  top: 4px;
  left: 12px;
  font-size: 0.75rem;
  color: #8b949e;
  z-index: 1;
  pointer-events: none;
}

@keyframes conveyor-bg {
  0% { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

.conveyor-strip .conveyor-track {
  display: flex;
  gap: 16px;
  animation: conveyor-scroll 14s linear infinite;
}

@keyframes conveyor-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.offer-btn {
  flex-shrink: 0;
  width: 110px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #388bfd;
  background: linear-gradient(180deg, #238636 0%, #196c2e 100%);
  color: #fff;
  cursor: grab;
  font-size: 0.85rem;
  text-align: center;
  white-space: normal;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  -webkit-user-drag: element;
}

.offer-btn:active {
  cursor: grabbing;
}

.offer-btn.dragging {
  opacity: 0.7;
  cursor: grabbing;
}

.offer-btn:hover:not(.dragging) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 139, 253, 0.35);
}

.offer-btn .offer-emoji {
  display: block;
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.offer-btn .offer-price {
  font-weight: 600;
  color: #ffd700;
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 10px;
  font-size: 0.9rem;
}

.status-bar-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.status-bar-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.status-bar-value {
  font-weight: 600;
  color: #e6edf3;
}

.status-bar-time-weather {
  margin-left: auto;
}

.status-bar-time-weather.weather-rain .status-bar-value { color: #79c0ff; }
.status-bar-time-weather.weather-cloudy .status-bar-value { color: #8b949e; }

.world-map-wrap {
  position: relative;
  min-height: 180px;
  border: 1px solid #30363d;
  border-radius: 10px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #0d1117 0%, #161b22 100%);
  overflow: hidden;
}

.world-map-title {
  font-size: 0.8rem;
  color: #8b949e;
  padding: 6px 10px;
  border-bottom: 1px solid #21262d;
}

.world-map {
  position: relative;
  width: 100%;
  height: 160px;
  background: radial-gradient(ellipse at 50% 50%, #1a2332 0%, #0d1117 70%);
}

.world-map-panel {
  display: flex;
  flex-direction: column;
}

.world-map-wrap-square {
  overflow: hidden;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #0d1117;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  min-width: 320px;
  min-height: 320px;
  width: 320px;
  height: 320px;
  flex-shrink: 0;
}

.world-map-wrap-square .world-map {
  position: absolute;
  inset: 12px;
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  background: radial-gradient(ellipse at 50% 50%, #1a2332 0%, #0d1117 70%);
}

.world-map-biomes {
  background: linear-gradient(
    90deg,
    #1e3320 0%,
    #1e3320 33.33%,
    #152a48 33.33%,
    #152a48 66.66%,
    #2d2d2d 66.66%,
    #2d2d2d 100%
  );
}

.tabs-wrap {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tabs-wrap > .error-msg {
  margin-bottom: 8px;
  flex-shrink: 0;
}

.tabs-list {
  display: flex;
  gap: 0;
  padding: 0 4px;
  background: #161b22;
  border-radius: 10px 10px 0 0;
}

.tab-btn {
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #8b949e;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  color: #e6edf3;
}

.tab-btn.active {
  color: #58a6ff;
  border-bottom-color: #58a6ff;
}

.tabs-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  border: 1px solid #30363d;
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 12px;
}

.tab-panel {
  display: none;
  flex: 1 1 auto;
  min-height: 320px;
  flex-direction: column;
  overflow: auto;
}

.tab-panel.active {
  display: flex;
}

#tab-panel-world {
  position: relative;
}

.world-map-actions {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.world-map-upgrade-zone {
  width: 56px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px dashed #2d4a6f;
  background: rgba(30, 58, 95, 0.95);
  color: #e6edf3;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.world-map-upgrade-zone:hover,
.world-map-upgrade-zone.can-upgrade {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

.world-map-upgrade-zone-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.world-map-upgrade-zone-label {
  font-size: 0.6rem;
  margin-top: 2px;
}

.world-map-upgrade-zone-arrow {
  display: none;
  font-size: 0.7rem;
  margin-top: 2px;
  color: #58a6ff;
}

.world-map-upgrade-zone.can-upgrade .world-map-upgrade-zone-arrow {
  display: block;
}

.world-map-truck-drop-zone {
  width: 56px;
  height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px dashed #8b949e;
  background: rgba(33, 38, 45, 0.95);
  color: #8b949e;
  cursor: default;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.world-map-truck-drop-zone:hover,
.world-map-truck-drop-zone.dragover {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
  color: #e6edf3;
}

.world-map-truck-drop-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.world-map-truck-drop-label {
  font-size: 0.6rem;
  margin-top: 2px;
}

.tab-panel-title {
  margin: 0 0 8px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #58a6ff;
}

.tab-panel .section-with-help {
  margin-bottom: 8px;
}

.world-map-zoo-slot {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 4px;
}

.world-map-zoo-icon {
  font-size: 1.8rem;
  line-height: 1;
  opacity: 0.9;
}

.world-map-offer-single {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  font-size: 0.75rem;
}

.world-map-offer-single .offer-emoji {
  font-size: 1.2rem;
}

.world-map-offer-single .offer-label {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.world-map-offer-single .offer-price {
  font-size: 0.7rem;
}

.world-map-city {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
}

.world-map-lab {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #6f42c1;
  background: rgba(111, 66, 193, 0.2);
  font-size: 0.7rem;
  z-index: 3;
}

.world-map-lab .world-map-zoo-name {
  color: #d2a8ff;
}

.world-map-trucks {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  z-index: 10;
}

.world-map-truck-npc {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.2rem;
  opacity: 0.9;
}

.world-map-zoo {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #21262d;
  font-size: 0.7rem;
}

.world-map-zoo-player {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
}

.world-map-zoo-name {
  font-weight: 600;
  color: #e6edf3;
  margin-bottom: 4px;
  white-space: nowrap;
}

.world-map-zoo-indicators {
  font-size: 0.7rem;
  color: #8b949e;
  margin-bottom: 2px;
  white-space: nowrap;
}

.world-map-zoo-offers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.world-map-offer {
  width: 64px;
  padding: 4px 6px;
  font-size: 0.65rem;
}

.world-map-offer .offer-emoji {
  font-size: 1.2rem;
}

.world-map-truck {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  pointer-events: none;
  z-index: 10;
  transition: left 0.05s linear, top 0.05s linear;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.actions button {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: linear-gradient(180deg, #21262d 0%, #161b22 100%);
  color: #e6edf3;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}

.actions button:hover {
  background: #30363d;
  border-color: #58a6ff;
}

.grid-wrap {
  overflow: auto;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #0d1117;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
}

.grid {
  display: inline-grid;
  gap: 4px;
  padding: 6px;
}

.plot-upgrade-zone {
  position: absolute;
  right: 12px;
  bottom: 76px;
  width: 56px;
  height: 56px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px dashed #3d5c38;
  background: rgba(45, 74, 42, 0.95);
  color: #e6edf3;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.plot-upgrade-zone:hover,
.plot-upgrade-zone.can-upgrade {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

.plot-upgrade-zone-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
}

.plot-upgrade-zone-label {
  font-size: 0.6rem;
  margin-top: 2px;
}

.plot-upgrade-zone-arrow {
  display: none;
  font-size: 0.7rem;
  margin-top: 2px;
  color: #58a6ff;
}

.plot-upgrade-zone.can-upgrade .plot-upgrade-zone-arrow {
  display: block;
}

.sell-zone {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 56px;
  height: 56px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 2px dashed #8b949e;
  background: rgba(33, 38, 45, 0.95);
  color: #8b949e;
  cursor: default;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.sell-zone:hover,
.sell-zone.dragover {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
  color: #e6edf3;
}

.sell-zone-icon {
  font-size: 1.5rem;
  line-height: 1;
  display: block;
}

.sell-zone-label {
  font-size: 0.6rem;
  margin-top: 2px;
}

.sell-zone.can-upgrade .sell-zone-upgrade-arrow {
  display: block;
}

.sell-zone-upgrade-arrow {
  display: none;
  font-size: 0.7rem;
  margin-top: 2px;
  color: #58a6ff;
}

.cell.school {
  background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
  color: #e6edf3;
  border-color: #4a5568;
}

.cell.school.can-upgrade {
  box-shadow: 0 0 0 2px #58a6ff;
}

.cell.plot-upgrade {
  background: linear-gradient(145deg, #2d4a2a 0%, #1e3320 100%);
  color: #e6edf3;
  border-color: #3d5c38;
}

.cell.plot-upgrade.can-upgrade {
  box-shadow: 0 0 0 2px #58a6ff;
}

.cell.nursery {
  background: linear-gradient(145deg, #2d3748 0%, #1a202c 100%);
  color: #e6edf3;
  border-color: #4a5568;
}

.cell.souvenir-shop {
  background: linear-gradient(145deg, #3d2a1a 0%, #2a1e14 100%);
  color: #e6edf3;
  border-color: #5c4033;
}

.cell.empty-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.cell-choice-btn {
  font-size: 0.7rem;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #e6edf3;
  cursor: pointer;
}

.cell-choice-btn:hover {
  border-color: #58a6ff;
  background: rgba(88, 166, 255, 0.15);
}

.cell.world-map-upgrade {
  background: linear-gradient(145deg, #1e3a5f 0%, #152a48 100%);
  color: #e6edf3;
  border-color: #2d4a6f;
}

.cell.world-map-upgrade.can-upgrade {
  box-shadow: 0 0 0 2px #58a6ff;
}

.cell-upgrade-arrow {
  display: block;
  font-size: 0.65rem;
  color: #58a6ff;
  margin-top: 1px;
}

.visitors-layer {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  pointer-events: none;
  z-index: 1;
}

.visitor-sprite {
  position: absolute;
  width: 20px;
  height: 20px;
  font-size: 16px;
  line-height: 20px;
  text-align: center;
  transition: left 0.15s linear, top 0.15s linear;
  will-change: left, top;
}

.cell {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  cursor: pointer;
  background: #21262d;
  color: #8b949e;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  line-height: 1.1;
  user-select: none;
  -webkit-user-select: none;
}

.cell:hover {
  transform: scale(1.05);
}

.cell.empty {
  background: #161b22;
  border-style: dashed;
  border-color: #30363d;
}

.cell.biome-meadow.empty {
  background: linear-gradient(145deg, #2d4a2a 0%, #1e3320 100%);
  border-color: #3d5c38;
}

.cell.biome-ocean.empty {
  background: linear-gradient(145deg, #1e3a5f 0%, #152a48 100%);
  border-color: #2d4a6f;
}

.cell.biome-mountain.empty {
  background: linear-gradient(145deg, #4a4a4a 0%, #2d2d2d 100%);
  border-color: #5c5c5c;
}

.cell.egg.biome-meadow { border-color: #6b8e23; }
.cell.egg.biome-ocean { border-color: #1e90ff; }
.cell.egg.biome-mountain { border-color: #8b7355; }
.cell.animal.biome-meadow { box-shadow: 0 0 8px rgba(107, 142, 35, 0.4); }
.cell.animal.biome-ocean { box-shadow: 0 0 8px rgba(30, 144, 255, 0.4); }
.cell.animal.biome-mountain { box-shadow: 0 0 8px rgba(139, 115, 85, 0.4); }

.cell.just-hatched {
  animation: hatch-pop 0.6s ease-out;
}

@keyframes hatch-pop {
  0% { transform: scale(0.3); opacity: 0.8; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.cell.animal .cell-emoji {
  animation: animal-idle 2.5s ease-in-out infinite;
}

@keyframes animal-idle {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.cell.selected {
  border-color: #58a6ff;
  box-shadow: 0 0 0 2px #58a6ff;
}

.cell.egg {
  background: linear-gradient(145deg, #d4a84b 0%, #b8860b 100%);
  color: #1a1e24;
  border-color: #daa520;
  font-weight: 600;
}

.cell.animal {
  background: linear-gradient(145deg, #388bfd 0%, #1f6feb 100%);
  color: #fff;
  border-color: #58a6ff;
  font-weight: 600;
}

.cell .cell-emoji {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 0;
}

.cell .cell-label {
  font-size: 0.55rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.cell-draggable {
  cursor: grab;
}

.drag-ghost {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 48px;
  height: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 2px solid #30363d;
  box-sizing: border-box;
  pointer-events: none;
}

.drag-ghost.cell.egg {
  background: linear-gradient(145deg, #d4a84b 0%, #b8860b 100%);
  color: #1a1e24;
}

.drag-ghost.cell.animal {
  background: linear-gradient(145deg, #388bfd 0%, #1f6feb 100%);
  color: #fff;
}

.cell.dragover {
  outline: 2px dashed #58a6ff;
  outline-offset: 2px;
}

.error-msg {
  color: #f85149;
  font-size: 0.85rem;
  margin-top: 10px;
  padding: 8px;
  background: rgba(248, 81, 73, 0.1);
  border-radius: 6px;
  border-left: 3px solid #f85149;
}

/* Bulles d'aide */
.help-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #30363d;
  color: #58a6ff;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: help;
  border: 1px solid #484f58;
  flex-shrink: 0;
}

.help-icon:hover {
  background: #388bfd;
  color: #fff;
}

.help-icon:hover + .tooltip-bubble,
.tooltip-bubble:hover {
  opacity: 1;
  visibility: visible;
}

.tooltip-bubble {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 8px;
  padding: 10px 12px;
  max-width: 260px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #e6edf3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 100;
  pointer-events: none;
}

.help-wrap .tooltip-bubble {
  pointer-events: auto;
}

.section-with-help {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-with-help .help-wrap {
  order: 1;
}

.section-with-help h2 {
  margin: 0;
}

.tooltip-bubble.below {
  left: 0;
  top: 100%;
  margin-left: 0;
  margin-top: 8px;
  transform: none;
}

.status-small {
  font-size: 0.8rem;
  margin-bottom: 4px;
}

.time-weather {
  text-transform: capitalize;
}

.weather-rain { color: #79c0ff; }
.weather-cloudy { color: #8b949e; }

.quest-panel {
  min-width: 260px;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.quest-item {
  font-size: 0.85rem;
  padding: 6px 10px;
  background: #0d1117;
  border-radius: 6px;
  border-left: 3px solid #58a6ff;
}

.quest-item.done {
  border-left-color: #3fb950;
  opacity: 0.85;
}

.prestige-btn {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #da3633;
  background: linear-gradient(180deg, #3d1f1f 0%, #2a1515 100%);
  color: #f85149;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
}

.prestige-btn:hover:not(:disabled) {
  background: #4d2525;
  border-color: #f85149;
}

.prestige-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.restart-btn {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #30363d;
  background: #21262d;
  color: #8b949e;
  cursor: pointer;
  font-size: 0.9rem;
  width: 100%;
}

.restart-btn:hover:not(:disabled) {
  background: #30363d;
  border-color: #58a6ff;
  color: #e6edf3;
}

.restart-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
